{"record":{"id":"922aaeed3549d615","repo":"jdx/mise","slug":"tap-repository-tree-was-truncated","errorCode":null,"errorMessage":"tap repository tree was truncated","messagePattern":"tap repository tree was truncated","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap.rs","lineNumber":261,"sourceCode":"    let mut parts = rest.split('/');\n    match (parts.next(), parts.next(), parts.next()) {\n        (Some(repo_owner), Some(repo), None) if !repo_owner.is_empty() && !repo.is_empty() => {\n            Ok((repo_owner, repo.to_string()))\n        }\n        _ => bail!(\"invalid GitHub tap URL '{url}'\"),\n    }\n}\n\nasync fn fetch_formula_source(tap_source: &TapSource, name: &str) -> Result<(String, String)> {\n    let root_tree: GithubTree = HTTP_FETCH\n        .json_cached(format!(\n            \"{}/git/trees/{}\",\n            tap_source.api_base, tap_source.commit\n        ))\n        .await\n        .wrap_err(\"failed to inspect tap formula directories\")?;\n    if root_tree.truncated {\n        bail!(\"tap repository tree was truncated\");\n    }\n\n    let (directory, formula_tree) =\n        if let Some((directory, sha)) = active_formula_directory(&root_tree) {\n            let tree: GithubTree = HTTP_FETCH\n                .json_cached(format!(\n                    \"{}/git/trees/{sha}?recursive=1\",\n                    tap_source.api_base\n                ))\n                .await\n                .wrap_err_with(|| format!(\"failed to inspect tap {directory} directory\"))?;\n            if tree.truncated {\n                bail!(\"tap {directory} directory tree was truncated\");\n            }\n            (directory, tree)\n        } else {\n            (\"\", root_tree)\n        };","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/tap.rs#L243-L279","documentation":"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.","triggerScenarios":"GET /git/trees/<commit> for the tap repository returns truncated=true — the tap repo has too many entries for one API response.","commonSituations":"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.","solutions":["Retry later or reduce the tap's repository size upstream","Pin/choose a tap commit whose tree is not truncated","Fetch the specific formula file path directly (raw URL) instead of walking the tree"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"tap repository tree was truncated\") => {\n        // pin an older/smaller tap commit or fetch the formula raw path directly\n    }\n    other => other,\n}","preventionTips":["Prefer taps with modest repository sizes","Pin tap commits when reproducibility matters","Handle the truncated flag by falling back to direct raw file fetches"],"tags":["brew","github","api"],"backgroundTag":"http-error-response","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"}