Verify latest release
pnpm version
10.33.0 (also confirmed in 10.33.1 and 11.0.0-rc.5)
Which area(s) of pnpm are affected?
CLI
Link to the code that reproduces this issue
https://github.com/shoebox639/pnpm-recursive-filter-root-bug
Reproduction steps
git clone https://github.com/shoebox639/pnpm-recursive-filter-root-bug.git
cd pnpm-recursive-filter-root-bug
# Correct: root excluded
pnpm --recursive exec pwd
# a
# b
# Bug: root appears in output when any --filter is passed
pnpm --recursive --filter '!a' exec pwd
# b
# . <-- workspace root, should not be here
The workspace has only a root package.json (private: true) and two sub-packages a and b. No includeWorkspaceRoot setting is configured anywhere.
Describe the Bug
When any --filter argument is passed to pnpm --recursive run/exec, the workspace root package is included in the matched set of workspace projects, contrary to the documented default:
Runs a command in every project of a workspace, excluding the root project, when used with the following commands: exec, run, test, add.
Without any --filter, the root is correctly excluded. As soon as any --filter (positive or negative) is present, pnpm begins treating the workspace root as one of the matched projects.
The Scope: line in -r output makes this visible in 11.0.0-rc.5:
$ pnpm --recursive --filter '!a' exec pwd
Scope: all 3 workspace projects <-- includes root
Explicitly setting include-workspace-root=false (the default) does not change this behavior when filters are in use.
Affected versions
| pnpm version |
Behavior |
| 10.13.0 |
✅ root excluded (correct) |
| 10.33.0 |
❌ root included |
| 10.33.1 |
❌ root included |
| 11.0.0-rc.5 |
❌ root included |
Regression range: works in 10.13.0, broken by 10.33.0.
Expected Behavior
Per the cli/recursive docs, the workspace root should be excluded from -r run/exec/test/add regardless of whether --filter arguments are passed, unless includeWorkspaceRoot: true is explicitly configured.
Which Node.js version are you using?
22.21.0
Which operating systems have you used?
If your OS is a Linux based, which one it is?
N/A — reproduced on macOS 26.4.1 (arm64)
Verify latest release
pnpm version
10.33.0 (also confirmed in 10.33.1 and 11.0.0-rc.5)
Which area(s) of pnpm are affected?
CLI
Link to the code that reproduces this issue
https://github.com/shoebox639/pnpm-recursive-filter-root-bug
Reproduction steps
The workspace has only a root
package.json(private: true) and two sub-packagesaandb. NoincludeWorkspaceRootsetting is configured anywhere.Describe the Bug
When any
--filterargument is passed topnpm --recursive run/exec, the workspace root package is included in the matched set of workspace projects, contrary to the documented default:Without any
--filter, the root is correctly excluded. As soon as any--filter(positive or negative) is present, pnpm begins treating the workspace root as one of the matched projects.The
Scope:line in-routput makes this visible in 11.0.0-rc.5:Explicitly setting
include-workspace-root=false(the default) does not change this behavior when filters are in use.Affected versions
Regression range: works in 10.13.0, broken by 10.33.0.
Expected Behavior
Per the cli/recursive docs, the workspace root should be excluded from
-r run/exec/test/addregardless of whether--filterarguments are passed, unlessincludeWorkspaceRoot: trueis explicitly configured.Which Node.js version are you using?
22.21.0
Which operating systems have you used?
If your OS is a Linux based, which one it is?
N/A — reproduced on macOS 26.4.1 (arm64)