jdx/mise · error
tap repository tree was truncated
Error message
tap repository tree was truncated
What it means
When inspecting a Homebrew tap via the GitHub API (GET /git/trees/{commit}), the response can carry truncated=true, meaning GitHub omitted entries because the tree is too large. The library refuses to continue because formula discovery would silently miss directories/files, so it bails with this error rather than return incomplete results.
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 afd2eddd3a)
Solutions
- Retry the operation — truncation can occasionally vary, though for genuinely oversized trees it will recur.
- Use a full git clone of the tap instead of the GitHub trees API, then read the formula locally.
- Narrow the query to a specific subdirectory or path so the returned tree stays under GitHub's limits.
- Pin to a specific commit whose tree is smaller, or split the tap into smaller taps.
Example fix
// before: relying on trees API for a huge tap
let tree = github_tree(api_base, commit).await?;
// after: fall back to a local clone when the API tree is truncated
let tree = match github_tree(api_base, commit).await {
Ok(t) if !t.truncated => t,
_ => clone_and_read_tap_locally(tap_url, commit).await?,
}; Defensive patterns
Strategy: retry
Validate before calling
// No client-side pre-check possible; GitHub sets truncated itself.
// Detect it after the call and fall back:
let tree: GithubTree = resp.json().await?;
if tree.truncated { /* fall back to git clone */ } Type guard
fn is_complete_tree(t: &GithubTree) -> bool { !t.truncated } Try / catch
match fetch_formula_source(tap, name).await {
Err(e) if e.to_string().contains("truncated") => clone_tap_and_read_locally(tap, name).await,
other => other,
} Prevention
- Prefer a local git clone for very large taps instead of the trees API
- Keep taps small; avoid monorepo-scale tap repositories
- Cache successful tree responses and only re-query on commit change
When it happens
Trigger: fetch_formula_source calls the GitHub trees API for the tap's commit and the returned root tree has truncated=true — i.e. the tap repository tree exceeds GitHub's tree API limits (very large repos, taps with thousands of entries or huge non-formula directories).
Common situations: Querying very large or monorepo-style taps (e.g. homebrew/cask or an enormous personal tap) whose root tree exceeds GitHub's size cap; network-level API usage without any narrowing ref; GitHub truncating trees for repos with tens of thousands of objects.
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
- tap {directory} directory tree was truncated
- brew: tapped formula '{name}' needs a GitHub tap URL in [boo
- brew-cask: unsupported tap URL for '{name}'; only GitHub tap
- tap formula name mismatch: requested '{name}', extracted '{}
- invalid GitHub tap URL '{url}'
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/922aaeed3549d615.
Report an issue: GitHub.