phacility/phabricator · error · Exception
Expected " \t ", for ls-tree of " : ", got
Error message
Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree of "%s:%s", got: %s
What it means
Parse guard in DiffusionBrowseQueryConduitAPIMethod::getGitResult: a raw 'git ls-tree' line could not be split into the expected five fields (mode, type, hash, size, name) by the whitespace-split parser. This is a low-level defensive check against unexpected git output — the line for the requested path/commit is malformed relative to the documented ls-tree format, so the method refuses to guess at parsing it.
Solutions
- Retry the browse query; transient git or filesystem hiccups can produce truncated output
- Verify the requested path and commit exist in the repository and produce sane ls-tree output when run manually
- If reproducible, inspect the raw git output for the affected path to identify the anomaly (unusual filenames or git version differences) and report it upstream
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php:161 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/6d90a2050b9631f3.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php:161
$path);
}
$submodules = array();
$count = 0;
$results = array();
$lines = empty($stdout)
? array()
: explode("\0", rtrim($stdout));
foreach ($lines as $line) {
// NOTE: Limit to 5 components so we parse filenames with spaces in them
// correctly.
// NOTE: The output uses a mixture of tabs and one-or-more spaces to
// delimit fields.
$parts = preg_split('/\s+/', $line, 5);
if (count($parts) < 5) {
throw new Exception(
pht(
'Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree of '.
'"%s:%s", got: %s',
$commit,
$path,
$line));
}
list($mode, $type, $hash, $size, $full_path) = $parts;
$path_result = new DiffusionRepositoryPath();
if ($type == 'tree') {
$file_type = DifferentialChangeType::FILE_DIRECTORY;
} else if ($type == 'commit') {
$file_type = DifferentialChangeType::FILE_SUBMODULE;
$submodules[] = $path_result;
} else {View on GitHub (pinned to 5720a38cfe)