phacility/phabricator · error · Exception
Unexpected number of output lines from "git cat-file" when p
Error message
Unexpected number of output lines from "git cat-file" when processing commit ("%s"). What it means
DiffusionLowLevelFilesizeQuery computes the size of every file changed in a Git commit. It maps each changed path to its new blob hash via git diff-tree, then pipes the distinct hashes into 'git cat-file --batch-check=%(objectsize)' and consumes exactly one output line per hash. If cat-file returns fewer lines than hashes submitted, entries remain unconsumed in $check_paths and this exception is thrown for the commit identifier.
Source
Thrown at src/applications/diffusion/query/lowlevel/DiffusionLowLevelFilesizeQuery.php:115
$future->write(implode("\n", array_keys($check_paths)));
$size_lines = id(new LinesOfALargeExecFuture($future))
->setDelimiter("\n");
foreach ($size_lines as $line) {
$object_size = (int)$line;
$object_hash = head_key($check_paths);
$path_names = $check_paths[$object_hash];
unset($check_paths[$object_hash]);
foreach ($path_names as $path_name) {
$path_sizes[$path_name] = $object_size;
}
}
if ($check_paths) {
throw new Exception(
pht(
'Unexpected number of output lines from "git cat-file" when '.
'processing commit ("%s").',
$identifier));
}
return $path_sizes;
}
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Run 'git fsck' inside the repository's local path as the daemon user to locate missing or corrupt objects
- Repair by deleting the local working copy and re-cloning: bin/repository update <callsign> (or trigger re-clone from Diffusion -> Manage)
- Verify the daemon user can read every file under the local path; permission holes mimic corruption
- Retry after any in-flight git gc finishes; if it persists, the commit's blobs are genuinely absent and only a re-clone fixes it
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-verify the commit's blobs exist before the size query
$future = $repository->getLocalCommandFuture('cat-file -e %s', $blob_hash);
list(, $err) = $future->resolve();
if ($err) {
// object missing: skip size rendering for this commit
} Try / catch
try {
$sizes = id(new DiffusionLowLevelFilesizeQuery())
->setRepository($repository)
->withIdentifier($commit_identifier)
->executeQuery();
} catch (Exception $ex) {
$sizes = array(); // sizes are cosmetic: degrade gracefully and log for triage
phlog($ex);
} Prevention
- Treat file sizes as optional data so a corrupt object never breaks commit rendering
- Run git fsck after any storage incident and re-clone damaged repositories
- Keep daemon-side gc/prune from racing heavy browsing windows
When it happens
Trigger: Executing DiffusionLowLevelFilesizeQuery (used when rendering changed-file sizes for a commit page) on a commit whose blob objects are missing from the local clone, so cat-file emits no record for them; also when the object store is corrupted or being rewritten by a concurrent gc/repack.
Common situations: Corrupt or partially-pruned local clones after disk problems, interrupted clones, broken alternates, or a git gc racing the query. Typically one specific commit fails while neighbors render fine.
Related errors
- Commit "%s" does not exist.
- Commit "%s" is not valid.
- To search for commits which are ancestors of particular refs
- Unexpected number of output lines from "git diff-tree" when
- No commit "%s" in this repository.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/7ac7a3e926dc440c.
Report an issue: GitHub.