{"record":{"id":"d759fabba5a545b9","repo":"zed-industries/zed","slug":"failed-to-checkout-revision-rev-in-directory-directory","errorCode":null,"errorMessage":"failed to checkout revision {rev} in directory {directory:?}: {}","messagePattern":"failed to checkout revision (.+?) in directory (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/extension/src/extension_builder.rs","lineNumber":397,"sourceCode":"            .output()\n            .await\n            .context(\"executing `git fetch`\")?;\n\n        let checkout_output = util::command::new_command(\"git\")\n            .arg(\"--git-dir\")\n            .arg(&git_dir)\n            .args([\"checkout\", rev])\n            .current_dir(directory)\n            .output()\n            .await\n            .context(\"executing `git checkout`\")?;\n        if !checkout_output.status.success() {\n            anyhow::ensure!(\n                fetch_output.status.success(),\n                \"failed to fetch revision {rev} in directory {directory:?}\"\n            );\n            anyhow::bail!(\n                \"failed to checkout revision {rev} in directory {directory:?}: {}\",\n                String::from_utf8_lossy(&checkout_output.stderr)\n            );\n        }\n\n        Ok(())\n    }\n\n    async fn install_rust_wasm_target_if_needed(&self) -> Result<()> {\n        let rustc_output = util::command::new_command(\"rustc\")\n            .args([\"--print\", \"target-libdir\", \"--target\", RUST_TARGET])\n            .output()\n            .await\n            .context(\"running rustc\")?;\n        anyhow::ensure!(\n            rustc_output.status.success(),\n            \"failed to retrieve the `{RUST_TARGET}` target libdir: {}\",\n            String::from_utf8_lossy(&rustc_output.stderr)\n        );","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/extension/src/extension_builder.rs#L379-L415","documentation":"Raised in checkout_repo when `git checkout <rev>` fails after cloning a tree-sitter grammar repo. The ensure! guard fires because the checkout command returned a non-zero status, and the formatted args append the captured stderr/stdout of the failed checkout so the real git error (typically an unknown revision, a detached worktree, or a corrupt object database) is visible. The fetch status check on the next line is a secondary diagnostic: the revision may simply never have been fetched.","triggerScenarios":"Thrown at crates/extension/src/extension_builder.rs:397 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the revision pinned in the extension's grammar manifest actually exists in the upstream repository (git ls-remote <url> <rev>)","Delete the cached grammar directory so checkout_repo re-clones it from scratch, clearing a corrupt .git or a clone missing the needed refs","Ensure git can reach the network: the fetch that precedes checkout must succeed before the revision is available","Inspect the appended git output in the error message for the underlying cause (unknown revision, permission denied, lock file)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-12T19:35:53.743Z","contentChangedAt":"2026-09-12T19:35:53.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}