{"record":{"id":"0981e4b59ee9ebb6","repo":"oven-sh/bun","slug":"expected-folder-path-to-contain-patch-hash-thi","errorCode":null,"errorMessage":"Expected folder path to contain `patch_hash=`, this is a bug in Bun. Please file a GitHub issue.","messagePattern":"Expected folder path to contain `patch_hash=`, this is a bug in Bun\\. Please file a GitHub issue\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/install/PackageManager/PackageManagerLifecycle.rs","lineNumber":182,"sourceCode":"                    directories::is_package_in_cache(self, folder_path, pkg.resolution.tag)\n                };\n                if in_cache {\n                    self.set_preinstall_state(pkg.meta.id, PreinstallState::Done);\n                    return PreinstallState::Done;\n                }\n\n                // If the package is patched, then `folder_path` looks like:\n                // is-even@1.0.0_patch_hash=abc8s6dedhsddfkahaldfjhlj\n                //\n                // If that's not in the cache, we need to put it there:\n                // 1. extract the non-patched pkg in the cache\n                // 2. copy non-patched pkg into temp dir\n                // 3. apply patch to temp dir\n                // 4. rename temp dir to `folder_path`\n                if patch_hash.is_some() {\n                    let idx = strings::index_of(folder_path.as_bytes(), b\"_patch_hash=\")\n                        .unwrap_or_else(|| {\n                            panic!(\n                                \"Expected folder path to contain `patch_hash=`, this is a bug in \\\n                                 Bun. Please file a GitHub issue.\"\n                            )\n                        });\n                    // Owned NUL-terminated copy.\n                    let non_patched_path = ZBox::from_bytes(&folder_path.as_bytes()[..idx]);\n                    if directories::is_package_in_cache(self, &non_patched_path, pkg.resolution.tag)\n                    {\n                        self.set_preinstall_state(pkg.meta.id, PreinstallState::ApplyPatch);\n                        // yay step 1 is already done for us\n                        return PreinstallState::ApplyPatch;\n                    }\n                    // we need to extract non-patched pkg into the cache\n                    self.set_preinstall_state(pkg.meta.id, PreinstallState::Extract);\n                    return PreinstallState::Extract;\n                }\n\n                self.set_preinstall_state(pkg.meta.id, PreinstallState::Extract);","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/install/PackageManager/PackageManagerLifecycle.rs#L164-L200","documentation":"Error \"Expected folder path to contain `patch_hash=`, this is a bug in Bun. Please file a GitHub issue.\" thrown in oven-sh/bun.","triggerScenarios":"Thrown at src/install/PackageManager/PackageManagerLifecycle.rs:182 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}