jdx/mise · error

tap repository tree was truncated

Error message

tap repository tree was truncated

What it means

The GitHub Trees API can return a truncated listing when a repository is very large. Before resolving formula directories, fetch_formula_source checks the root tree's `truncated` flag and bails rather than silently missing formulas from an incomplete listing.

Solutions

  1. Retry later or reduce the tap's repository size upstream
  2. Pin/choose a tap commit whose tree is not truncated
  3. Fetch the specific formula file path directly (raw URL) instead of walking the tree
Defensive patterns

Strategy: retry

Try / catch

match result {
    Err(e) if e.to_string().contains("tap repository tree was truncated") => {
        // pin an older/smaller tap commit or fetch the formula raw path directly
    }
    other => other,
}

Prevention

When it happens

Trigger: GET /git/trees/<commit> for the tap repository returns truncated=true — the tap repo has too many entries for one API response.

Common situations: Very large third-party taps with thousands of files; shallow clones replaced by huge monorepo-style taps; taps with long history of Casks+Formula directories.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/922aaeed3549d615. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/tap.rs:261

    let mut parts = rest.split('/');
    match (parts.next(), parts.next(), parts.next()) {
        (Some(repo_owner), Some(repo), None) if !repo_owner.is_empty() && !repo.is_empty() => {
            Ok((repo_owner, repo.to_string()))
        }
        _ => bail!("invalid GitHub tap URL '{url}'"),
    }
}

async fn fetch_formula_source(tap_source: &TapSource, name: &str) -> Result<(String, String)> {
    let root_tree: GithubTree = HTTP_FETCH
        .json_cached(format!(
            "{}/git/trees/{}",
            tap_source.api_base, tap_source.commit
        ))
        .await
        .wrap_err("failed to inspect tap formula directories")?;
    if root_tree.truncated {
        bail!("tap repository tree was truncated");
    }

    let (directory, formula_tree) =
        if let Some((directory, sha)) = active_formula_directory(&root_tree) {
            let tree: GithubTree = HTTP_FETCH
                .json_cached(format!(
                    "{}/git/trees/{sha}?recursive=1",
                    tap_source.api_base
                ))
                .await
                .wrap_err_with(|| format!("failed to inspect tap {directory} directory"))?;
            if tree.truncated {
                bail!("tap {directory} directory tree was truncated");
            }
            (directory, tree)
        } else {
            ("", root_tree)
        };

View on GitHub (pinned to 533346cc37)