{"record":{"id":"b3e078f73443bb4c","repo":"jdx/mise","slug":"tap-directory-directory-tree-was-truncated","errorCode":null,"errorMessage":"tap {directory} directory tree was truncated","messagePattern":"tap (.+?) directory tree was truncated","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap.rs","lineNumber":274,"sourceCode":"            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        };\n\n    let source_path = formula_source_path(directory, &formula_tree, name).ok_or_else(|| {\n        let location = if directory.is_empty() {\n            \"repository root\"\n        } else {\n            directory\n        };\n        eyre::eyre!(\"tap has no formula named '{name}' in {location}\")\n    })?;\n    let source = HTTP_FETCH\n        .get_text(ruby_source_url(&tap_source.raw_base, &source_path))\n        .await\n        .wrap_err_with(|| format!(\"failed to fetch tap formula {source_path}\"))?;","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/tap.rs#L256-L292","documentation":"After finding the active formula directory in a tap, the library fetches that directory's tree recursively via the GitHub trees API (?recursive=1). If that response is truncated=true, GitHub dropped entries, so the formula file listing would be incomplete and the library bails with this error.","triggerScenarios":"fetch_formula_source issues GET {api_base}/git/trees/{sha}?recursive=1 for a tap's formula directory and the response contains truncated=true — the directory (recursively) exceeds GitHub's tree API result limits.","commonSituations":"Taps whose Formula/ (or active) directory contains thousands of files; recursive listing of a directory with deep/large subtrees; large community taps exceeding GitHub's ~100k-entry / 7MB tree limits.","solutions":["Retry, though for oversized directories it will likely recur.","Clone the tap with git and enumerate the formula directory on disk instead of using the recursive trees API.","Request the non-recursive tree and fetch subdirectories individually to stay under limits.","Use the git blobs/contents API per file or the codeload tarball to enumerate files."],"exampleFix":"// before\nlet tree: GithubTree = HTTP_FETCH.json_cached(format!(\"{api_base}/git/trees/{sha}?recursive=1\")).await?;\n// after: fall back to local clone on truncation\nlet tree = if tree.truncated { clone_and_list_dir(tap_url, sha, directory).await? } else { tree };","handlingStrategy":"fallback","validationCode":"let tree: GithubTree = resp.json().await?;\nif tree.truncated { /* switch to clone-based enumeration */ }","typeGuard":"fn is_full_directory_tree(t: &GithubTree) -> bool { !t.truncated }","tryCatchPattern":"match fetch_formula_source(tap, name).await {\n    Err(e) if e.to_string().contains(\"was truncated\") => enumerate_formulas_from_clone(tap).await,\n    other => other,\n}","preventionTips":["Avoid recursive=1 on directories known to contain thousands of files; walk non-recursively","Prefer cloning taps with many formulas","Split oversized taps into smaller ones"],"tags":["network","github-api","homebrew","tap","truncated"],"backgroundTag":"http-error-response","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}