{"record":{"id":"d4e541ae90e24c99","repo":"pnpm/pnpm","slug":"missing-cas-paths-for-required-package-pkg-id-with-patch","errorCode":null,"errorMessage":"Missing CAS paths for required package {pkg_id_with_patch_hash:?} at {dir:?}","messagePattern":"Missing CAS paths for required package (.+?) at (.+?)","errorType":"exception","errorClass":"LinkPhaseError","httpStatus":null,"severity":"error","filePath":"pnpm/crates/deps-restorer/src/linking.rs","lineNumber":57,"sourceCode":"pub enum LinkPhaseError {\n    #[diagnostic(transparent)]\n    PruneStaleModules(#[error(source)] crate::PruneDirectDepsError),\n    #[diagnostic(transparent)]\n    SymlinkDirectDependencies(#[error(source)] crate::SymlinkDirectDependenciesError),\n    #[diagnostic(transparent)]\n    LinkRootComponentMembers(#[error(source)] crate::LinkRootComponentMembersError),\n    #[diagnostic(transparent)]\n    LinkVirtualStoreBins(#[error(source)] crate::LinkVirtualStoreBinsError),\n    #[diagnostic(transparent)]\n    HoistSymlink(#[error(source)] crate::SymlinkPackageError),\n    #[diagnostic(transparent)]\n    HoistLinkBins(#[error(source)] pnpm_cmd_shim::LinkBinsError),\n    #[diagnostic(transparent)]\n    LinkBins(#[error(source)] pnpm_cmd_shim::LinkBinsError),\n    #[diagnostic(transparent)]\n    HoistedDepGraph(#[error(source)] crate::HoistedDepGraphError),\n    #[diagnostic(transparent)]\n    LinkHoistedModules(#[error(source)] crate::LinkHoistedModulesError),\n    #[display(\"failed to write package map: {_0}\")]\n    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_WRITE_PACKAGE_MAP))]\n    WritePackageMap(#[error(source)] crate::WritePackageMapError),\n    #[display(\"failed to write PnP loader: {_0}\")]\n    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_WRITE_PNP_FILE))]\n    WritePnpFile(#[error(source)] crate::WritePnpFileError),\n}\n\nimpl From<HoistedLinkerError> for LinkPhaseError {\n    fn from(error: HoistedLinkerError) -> Self {\n        match error {\n            HoistedLinkerError::HoistedDepGraph(error) => LinkPhaseError::HoistedDepGraph(error),\n            HoistedLinkerError::LinkHoistedModules(error) => {\n                LinkPhaseError::LinkHoistedModules(error)\n            }\n            HoistedLinkerError::SymlinkDirectDependencies(error) => {\n                LinkPhaseError::SymlinkDirectDependencies(error)\n            }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/pnpm/pnpm/blob/e45f0332229b094d61f2ecad114a166e338c0d61/pnpm/crates/deps-restorer/src/linking.rs#L39-L75","documentation":"Raised by the hoisted-modules linker (LinkHoistedModulesError, surfaced as the LinkHoistedModules variant of LinkPhaseError). While materializing the hoisted node_modules hierarchy, a package snapshot that must be linked has no CAS (content-addressable store) paths registered for it. The linker cannot produce hard links/copies from the store because the package's files are missing from the index it was given - an internal consistency violation between the resolution graph and the store data.","triggerScenarios":"Running the hoisted linker (node-linker=hoisted or the hoisted install path) when the store index lacks entries for a required package id (including its patch hash): the store was pruned or deleted mid-flight, a patch hash changed but the store entry was not fetched, or the packages map passed into the phase is incomplete.","commonSituations":"Shared store corrupted by pnpm store prune while another project installs; interrupted fetch left the package absent; switching pnpm versions where the patch hash computation changed; mounted store on a network drive with lost files.","solutions":["Repopulate the store for the project: delete node_modules and reinstall so missing packages are fetched again.","Run a store verification/prune against the store directory and then reinstall if it reports missing or orphaned entries.","If using pnpm patches, remove and re-add the patch so the patched snapshot and its store entry agree.","Point the project at a healthy local store (store-dir) rather than a network/shared mount that lost files.","Report a bug if a normal install reproduces it - the graph and store data should never disagree."],"exampleFix":"// before: store entry missing for patched package\n$ pnpm install\nMissing CAS paths for required package \"lodash@4.17.21+patch_hash=abc123\" at ...\n// after\n$ rm -rf node_modules && pnpm install","handlingStrategy":"retry","validationCode":"# Verify the store contains the packages the lockfile needs before reinstalling\npnpm store status || echo \"store is missing entries; expect a full re-fetch\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid running pnpm store prune while other installs are in flight against the same store.","Keep the store directory on a reliable local disk, not a network share.","After changing pnpm patches, reinstall so patched snapshots are re-fetched.","Use a single pinned pnpm version per project so patch hashes stay stable."],"tags":["store","hoisting","install","missing-data"],"backgroundTag":"resource-not-found","analyzedSha":"e45f0332229b094d61f2ecad114a166e338c0d61","analyzedAt":"2026-09-22T05:07:20.233Z","contentChangedAt":"2026-09-22T05:07:20.233Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}