phacility/phabricator · error · Exception
The raw diff you have submitted is too large to parse
Error message
The raw diff you have submitted is too large to parse (it affects more than %s paths and hunks).
What it means
differential.createrawdiff bounds the work needed to persist a raw diff: it sums 1 + hunk count over every changeset in the parsed diff and rejects the call with a plain Exception when that total exceeds a hard-coded limit of 10000. The message reads 'The raw diff you have submitted is too large to parse (it affects more than %s paths and hunks).'.
Solutions
- Narrow the diff to the paths that matter: git diff -- <paths>, and exclude vendored/generated files
- Split the change into several smaller diffs/revisions if the work is genuinely that large
- Pre-compute the same size metric client-side (sum of 1 + hunks per path) and refuse to submit past 10000
- Note the limit is hard-coded server-side; there is no configuration to raise it - reduce the diff instead
Example fix
# before git diff master...feature | head -c 100M > /tmp/huge.diff # then submit /tmp/huge.diff -> rejected # after git diff master...feature -- ':!vendor' ':!*.min.js' > /tmp/d.diff # submit /tmp/d.diff
Defensive patterns
Strategy: validation
Validate before calling
// Mirror the server metric: 1 + hunks per path, limit 10000.
$size = 0;
foreach ($parsed_changes as $change) {
$size += 1 + count(idx($change, 'hunks', array()));
}
if ($size > 10000) {
throw new RuntimeException('Diff too large: '.$size.' paths+hunks; narrow it');
} Try / catch
try {
$client->callMethodSynchronous('differential.createrawdiff', $params);
} catch (ConduitClientException $ex) {
if (strpos($ex->getMessage(), 'too large to parse') !== false) {
// reduce scope (exclude paths) and resubmit once
} else {
throw $ex;
}
} Prevention
- Exclude vendored, generated, and lock files from diffs before submitting
- Compute paths+hunks client-side and refuse past 10000
- Keep raw-diff submissions scoped to reviewed paths, not whole trees
When it happens
Trigger: Submitting a raw diff that touches more than 10000 combined paths and hunks - whole-tree or monorepo diffs, vendored/generated code included, or a diff of many files each with several hunks.
Common situations: Developers running tools like 'git diff HEAD~50' on huge trees; CI jobs diffing with vendored dependencies not excluded; diffs containing minimized or lock-generated files with many hunks.
Related errors
- ERR-BAD-DIFF
- ERR_BAD_DIFF
- ERR_BAD_DIFF
- Field "changes" must be non-empty.
- Field "raw_diff" must be non-empty.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/6e3cf4fd6d7ad7d8.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php:59
pht('No such repository "%s"!', $repository_phid));
}
}
$parser = new ArcanistDiffParser();
$changes = $parser->parseDiff($raw_diff);
$diff = DifferentialDiff::newFromRawChanges($viewer, $changes);
// We're bounded by doing INSERTs for all the hunks and changesets, so
// estimate the number of inserts we'll require.
$size = 0;
foreach ($diff->getChangesets() as $changeset) {
$hunks = $changeset->getHunks();
$size += 1 + count($hunks);
}
$raw_limit = 10000;
if ($size > $raw_limit) {
throw new Exception(
pht(
'The raw diff you have submitted is too large to parse (it affects '.
'more than %s paths and hunks).',
new PhutilNumber($raw_limit)));
}
$diff_data_dict = array(
'creationMethod' => 'web',
'authorPHID' => $viewer->getPHID(),
'repositoryPHID' => $repository_phid,
'lintStatus' => DifferentialLintStatus::LINT_SKIP,
'unitStatus' => DifferentialUnitStatus::UNIT_SKIP,
);
$xactions = array(
id(new DifferentialDiffTransaction())
->setTransactionType(DifferentialDiffTransaction::TYPE_DIFF_CREATE)
->setNewValue($diff_data_dict),View on GitHub (pinned to 5720a38cfe)