{"record":{"id":"c00ef4dcf1adb17a","repo":"pnpm/pnpm","slug":"err-pnpm-workspace-package-not-found","errorCode":"ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND","errorMessage":"\"{_0}\" not found in the workspace","messagePattern":"\"(.+?)\" not found in the workspace","errorType":"exception","errorClass":"UpdateError::WorkspacePackageNotFound","httpStatus":null,"severity":"error","filePath":"pnpm/crates/package-manager/src/update.rs","lineNumber":170,"sourceCode":"/// Error type of [`Update`].\n#[derive(Debug, Display, Error, Diagnostic)]\npub enum UpdateError {\n    /// `--latest` was combined with a versioned selector (`foo@2`).\n    #[display(\"Specs are not allowed to be used with --latest ({_0})\")]\n    #[diagnostic(code(ERR_PNPM_LATEST_WITH_SPEC))]\n    LatestWithSpec(#[error(not(source))] String),\n\n    /// Package selectors were given with `--depth 0` but none matched a\n    /// direct dependency.\n    #[display(\"None of the specified packages were found in the dependencies.\")]\n    #[diagnostic(code(ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES))]\n    NoPackageInDependencies,\n\n    /// A `--workspace` selector named a dependency that no workspace\n    /// project publishes.\n    #[display(r#\"\"{_0}\" not found in the workspace\"#)]\n    #[diagnostic(code(ERR_PNPM_WORKSPACE_PACKAGE_NOT_FOUND))]\n    WorkspacePackageNotFound(#[error(not(source))] String),\n\n    /// A resolver failed while computing the specifier `--latest` should\n    /// write for a direct dependency.\n    #[display(\"Failed to resolve the latest version of {name}: {error}\")]\n    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_UPDATE_RESOLVE_LATEST))]\n    ResolveLatest {\n        name: String,\n        #[error(source)]\n        error: pnpm_resolving_resolver_base::ResolveError,\n    },\n\n    /// A `named-registries` alias is misconfigured.\n    #[diagnostic(transparent)]\n    InvalidNamedRegistry(#[error(source)] pnpm_resolving_npm_resolver::MergeNamedRegistriesError),\n\n    /// `minimumReleaseAgeExclude` contained an invalid rule.\n    #[display(\"Invalid value in minimumReleaseAgeExclude: {_0}\")]\n    #[diagnostic(code(ERR_PNPM_INVALID_MINIMUM_RELEASE_AGE_EXCLUDE))]","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/pnpm/pnpm/blob/6261b7f388016d57ca6b90340342411cd1d0d00f/pnpm/crates/package-manager/src/update.rs#L152-L188","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: directory name, not package name\npnpm update --workspace utils-lib\n# after: exact package.json name\npnpm update --workspace @acme/utils","handlingStrategy":"validation","validationCode":"# collect real workspace names before invoking update --workspace\npnpm -r list --depth -1 --json | jq -r '.[].name' > /tmp/ws-names.txt\ngrep -Fx \"$SEL\" /tmp/ws-names.txt || { echo \"not a workspace package: $SEL\"; exit 1; }\npnpm update --workspace \"$SEL\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["pnpm","update","workspace","monorepo"],"backgroundTag":"workspace-package-not-found","analyzedSha":"6261b7f388016d57ca6b90340342411cd1d0d00f","analyzedAt":"2026-08-17T18:30:54.750Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}