{"record":{"id":"6e3cf4fd6d7ad7d8","repo":"phacility/phabricator","slug":"the-raw-diff-you-have-submitted-is-too-large-to-pa","errorCode":null,"errorMessage":"The raw diff you have submitted is too large to parse (it affects more than %s paths and hunks).","messagePattern":"The raw diff you have submitted is too large to parse \\(it affects more than (.+?) paths and hunks\\)\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php","lineNumber":59,"sourceCode":"          pht('No such repository \"%s\"!', $repository_phid));\n      }\n    }\n\n    $parser = new ArcanistDiffParser();\n    $changes = $parser->parseDiff($raw_diff);\n    $diff = DifferentialDiff::newFromRawChanges($viewer, $changes);\n\n    // We're bounded by doing INSERTs for all the hunks and changesets, so\n    // estimate the number of inserts we'll require.\n    $size = 0;\n    foreach ($diff->getChangesets() as $changeset) {\n      $hunks = $changeset->getHunks();\n      $size += 1 + count($hunks);\n    }\n\n    $raw_limit = 10000;\n    if ($size > $raw_limit) {\n      throw new Exception(\n        pht(\n          'The raw diff you have submitted is too large to parse (it affects '.\n          'more than %s paths and hunks).',\n          new PhutilNumber($raw_limit)));\n    }\n\n    $diff_data_dict = array(\n      'creationMethod' => 'web',\n      'authorPHID' => $viewer->getPHID(),\n      'repositoryPHID' => $repository_phid,\n      'lintStatus' => DifferentialLintStatus::LINT_SKIP,\n      'unitStatus' => DifferentialUnitStatus::UNIT_SKIP,\n    );\n\n    $xactions = array(\n      id(new DifferentialDiffTransaction())\n        ->setTransactionType(DifferentialDiffTransaction::TYPE_DIFF_CREATE)\n        ->setNewValue($diff_data_dict),","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php#L41-L77","documentation":"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).'.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\ngit diff master...feature | head -c 100M > /tmp/huge.diff\n# then submit /tmp/huge.diff -> rejected\n\n# after\ngit diff master...feature -- ':!vendor' ':!*.min.js' > /tmp/d.diff\n# submit /tmp/d.diff","handlingStrategy":"validation","validationCode":"// Mirror the server metric: 1 + hunks per path, limit 10000.\n$size = 0;\nforeach ($parsed_changes as $change) {\n  $size += 1 + count(idx($change, 'hunks', array()));\n}\nif ($size > 10000) {\n  throw new RuntimeException('Diff too large: '.$size.' paths+hunks; narrow it');\n}","typeGuard":null,"tryCatchPattern":"try {\n  $client->callMethodSynchronous('differential.createrawdiff', $params);\n} catch (ConduitClientException $ex) {\n  if (strpos($ex->getMessage(), 'too large to parse') !== false) {\n    // reduce scope (exclude paths) and resubmit once\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["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"],"tags":["phabricator","conduit","differential","diff","size-limit"],"backgroundTag":"request-entity-too-large","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}