{"record":{"id":"56dc11802e251441","repo":"jdx/mise","slug":"failed-to-inspect-git-blob-oid","errorCode":null,"errorMessage":"failed to inspect Git blob {oid}","messagePattern":"failed to inspect Git blob (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/git.rs","lineNumber":836,"sourceCode":"            .stderr(Stdio::inherit())\n            .spawn()?;\n        let mut bytes = Vec::new();\n        // Keep the pipe open until Git has exited: dropping it before kill\n        // can make a large blob emit a spurious broken-pipe error on stderr.\n        let mut output = child\n            .stdout\n            .take()\n            .expect(\"stdout was piped\")\n            .take(prefix.len() as u64);\n        let read = output.read_to_end(&mut bytes);\n        let complete = bytes.len() == prefix.len();\n        if complete || read.is_err() {\n            let _ = child.kill();\n        }\n        let status = child.wait()?;\n        read?;\n        if !complete && !status.success() {\n            eyre::bail!(\"failed to inspect Git blob {oid}\");\n        }\n        Ok(bytes == prefix)\n    }\n\n    /// Runs the call and returns its full output without treating a non-zero\n    /// exit as an error, for commands whose status carries meaning.\n    pub(crate) fn output_unchecked(&self, call: PlumbingCall<'_>) -> Result<std::process::Output> {\n        let cmd = self.command(&call)?;\n        spawn_plumbing(cmd, call.stdin)\n    }\n\n    /// Runs the call with stdout and stderr inherited, for output that goes\n    /// straight to the terminal (a patch can be as large as a snapshot), and\n    /// returns its status without treating a non-zero exit as an error.\n    pub(crate) fn status_inherited(\n        &self,\n        call: PlumbingCall<'_>,\n    ) -> Result<std::process::ExitStatus> {","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/git.rs#L818-L854","documentation":"`blob_starts_with` inspects a git blob (e.g. to check whether a config file starts with a comment/shebang) by piping content through a `git cat-file` child process. If the command exits non-zero before completing, the blob could not be read (bad object, corrupt repo, missing permissions) and mise raises this error with the offending oid.","triggerScenarios":"Calling code that checks a blob's prefix (`blob_starts_with`) against a repository where `git cat-file blob <oid>` fails: object missing (shallow/partial clone, pruned objects), corrupted object store, or a broken git installation.","commonSituations":"Reading mise-managed config from a shallow-cloned or partially-fetched repo; repo garbage-collected mid-operation; git in a broken state (dubious ownership, permission issues); passing an oid from a different repository.","solutions":["Run `git cat-file -t <oid>` in the repo to confirm the object exists","Fetch missing objects (`git fetch --unshallow` or `git fetch origin`) for shallow/partial clones","Run `git fsck` to detect and repair a corrupt object store","Re-clone the repository if the object store is damaged beyond repair"],"exampleFix":"// before: shallow clone lacks the blob\n$ git clone --depth 1 <repo>\n// after\n$ git fetch --unshallow","handlingStrategy":"retry","validationCode":"git cat-file -t <oid> || echo 'blob missing from object store'","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"failed to inspect Git blob\") => {\n        // re-fetch / unshallow, then retry once\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Avoid shallow/partial clones for repos mise reads config from","Run `git fsck` after interrupted fetches or GC operations","Only pass oids obtained from the same repository"],"tags":["git","blob","object-store"],"backgroundTag":"git-command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}