jdx/mise · error

failed to inspect Git blob {oid}

Error message

failed to inspect Git blob {oid}

What it means

blob_starts_with streams `git cat-file blob <oid>` and reads only a prefix of the blob. If the read did not complete (prefix not fully read) and the git child process exited non-zero, mise cannot determine the blob's contents — typically because the object does not exist or the repository is corrupt — so it raises this error naming the oid.

Source

Thrown at src/git.rs:836

            .stderr(Stdio::inherit())
            .spawn()?;
        let mut bytes = Vec::new();
        // Keep the pipe open until Git has exited: dropping it before kill
        // can make a large blob emit a spurious broken-pipe error on stderr.
        let mut output = child
            .stdout
            .take()
            .expect("stdout was piped")
            .take(prefix.len() as u64);
        let read = output.read_to_end(&mut bytes);
        let complete = bytes.len() == prefix.len();
        if complete || read.is_err() {
            let _ = child.kill();
        }
        let status = child.wait()?;
        read?;
        if !complete && !status.success() {
            eyre::bail!("failed to inspect Git blob {oid}");
        }
        Ok(bytes == prefix)
    }

    /// Runs the call and returns its full output without treating a non-zero
    /// exit as an error, for commands whose status carries meaning.
    pub(crate) fn output_unchecked(&self, call: PlumbingCall<'_>) -> Result<std::process::Output> {
        let cmd = self.command(&call)?;
        spawn_plumbing(cmd, call.stdin)
    }

    /// Runs the call with stdout and stderr inherited, for output that goes
    /// straight to the terminal (a patch can be as large as a snapshot), and
    /// returns its status without treating a non-zero exit as an error.
    pub(crate) fn status_inherited(
        &self,
        call: PlumbingCall<'_>,
    ) -> Result<std::process::ExitStatus> {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Delete the cached git directory for that repository (e.g. under ~/.cache/mise/git) and let mise re-clone it.
  2. Run `git fsck` on the underlying repository/cache to diagnose corruption, then re-fetch.
  3. Re-run the operation that triggered the fetch so the missing objects are downloaded.
  4. Verify the git installation works (`git --version`, `git cat-file -e <oid>`) in the affected repo.
  5. Check disk space and permissions on the cache/git directory.

Example fix

# before: corrupted cached clone
$ rm -rf ~/.cache/mise/git/github.com/<owner>/<repo>
$ mise install  # re-clones and refetches objects
// after: operation succeeds with a fresh clone
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling blob_starts_with
const ok = await run(`git -C ${repoDir} cat-file -e ${oid}`); // non-zero => object missing

Try / catch

match repo.blob_starts_with(oid, prefix) {
    Ok(startsWith) => /* proceed */,
    Err(e) if e.to_string().contains("failed to inspect Git blob") => {
        // wipe the cached git dir for this repo and retry once after re-clone
        fs::remove_dir_all(cache_dir)?;
        let repo = Git::new(...)?; repo.blob_starts_with(oid, prefix)
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling Git::blob_starts_with(oid, prefix) where `git cat-file blob <oid>` exits non-zero (or fails to start reading) before the prefix is fully read: missing object, corrupt object store, or an unusable git directory.

Common situations: A fetched/shallow or pruned repository missing the blob oid; a partially cloned or interrupted git fetch leaving a dangling reference; the bare cache directory (e.g. ~/.cache/mise/git) deleted or corrupted mid-operation; disk errors or permissions on the git dir; git version incompatibilities writing unreadable objects.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/56dc11802e251441. Report an issue: GitHub.