pnpm/pnpm · error · UpdateError::WorkspacePackageNotFound
ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND
ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND
Error message
"{_0}" not found in the workspace What it means
Raised when `pnpm update --workspace <name>` names a selector that no workspace project publishes. The update command matches the selector against workspace projects; a miss yields ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND with the offending selector string.
Source
Thrown at pnpm/crates/package-manager/src/update.rs:170
/// Error type of [`Update`].
#[derive(Debug, Display, Error, Diagnostic)]
pub enum UpdateError {
/// `--latest` was combined with a versioned selector (`foo@2`).
#[display("Specs are not allowed to be used with --latest ({_0})")]
#[diagnostic(code(ERR_PNPM_LATEST_WITH_SPEC))]
LatestWithSpec(#[error(not(source))] String),
/// Package selectors were given with `--depth 0` but none matched a
/// direct dependency.
#[display("None of the specified packages were found in the dependencies.")]
#[diagnostic(code(ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES))]
NoPackageInDependencies,
/// A `--workspace` selector named a dependency that no workspace
/// project publishes.
#[display(r#""{_0}" not found in the workspace"#)]
#[diagnostic(code(ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND))]
WorkspacePackageNotFound(#[error(not(source))] String),
/// A resolver failed while computing the specifier `--latest` should
/// write for a direct dependency.
#[display("Failed to resolve the latest version of {name}: {error}")]
#[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_UPDATE_RESOLVE_LATEST))]
ResolveLatest {
name: String,
#[error(source)]
error: pnpm_resolving_resolver_base::ResolveError,
},
/// A `named-registries` alias is misconfigured.
#[diagnostic(transparent)]
InvalidNamedRegistry(#[error(source)] pnpm_resolving_npm_resolver::MergeNamedRegistriesError),
/// `minimumReleaseAgeExclude` contained an invalid rule.
#[display("Invalid value in minimumReleaseAgeExclude: {_0}")]
#[diagnostic(code(ERR_PNPM_INVALID_MINIMUM_RELEASE_AGE_EXCLUDE))]View on GitHub (pinned to 6261b7f388)
Solutions
- List the actual workspace package names (read each package.json name, or `pnpm -r list --depth -1`) and rerun with the exact name.
- Run the command from the workspace root so all projects are discovered.
- Fix the packages globs in pnpm-workspace.yaml so the intended project is part of the workspace.
Example fix
# before: directory name, not package name pnpm update --workspace utils-lib # after: exact package.json name pnpm update --workspace @acme/utils
Defensive patterns
Strategy: validation
Validate before calling
# collect real workspace names before invoking update --workspace
pnpm -r list --depth -1 --json | jq -r '.[].name' > /tmp/ws-names.txt
grep -Fx "$SEL" /tmp/ws-names.txt || { echo "not a workspace package: $SEL"; exit 1; }
pnpm update --workspace "$SEL" Prevention
- Reference workspace packages by their package.json name, never by directory name.
- Keep pnpm-workspace.yaml globs in sync when adding or moving projects.
- Run workspace-wide commands from the workspace root.
When it happens
Trigger: Run `pnpm update --workspace foo` where no workspace package is named foo: the name is typo'd, the intended project is not matched by the packages globs in pnpm-workspace.yaml, or the command runs in a standalone project with no workspace at all.
Common situations: Using a directory name instead of the package.json name; a newly added or moved project not covered by the workspace globs; running from a subfolder while assuming workspace-wide discovery; stale shells after a package rename.
Related errors
- BAD_OPTIONS
- WORKSPACE_OPTION_OUTSIDE_WORKSPACE
- DISALLOW_WORKSPACE_CYCLES
- NO_PACKAGE_IN_DEPENDENCIES
- There are cyclic workspace dependencies${cyclicDependenciesI
AI-assisted analysis of pnpm/pnpm@6261b7f388 (2026-08-17).
Data as JSON: /api/errors/c00ef4dcf1adb17a.
Report an issue: GitHub.