{"record":{"id":"b776cbd88a4bdefc","repo":"phacility/phabricator","slug":"err-not-found-b776cb","errorCode":"ERR_NOT_FOUND","errorMessage":"ERR_NOT_FOUND","messagePattern":"ERR_NOT_FOUND","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialGetRawDiffConduitAPIMethod.php","lineNumber":42,"sourceCode":"  protected function defineErrorTypes() {\n    return array(\n      'ERR_NOT_FOUND' => pht('Diff not found.'),\n    );\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $diff_id = $request->getValue('diffID');\n\n    $viewer = $request->getUser();\n\n    $diff = id(new DifferentialDiffQuery())\n      ->withIDs(array($diff_id))\n      ->setViewer($viewer)\n      ->needChangesets(true)\n      ->executeOne();\n\n    if (!$diff) {\n      throw new ConduitException('ERR_NOT_FOUND');\n    }\n\n    $renderer = id(new DifferentialRawDiffRenderer())\n      ->setChangesets($diff->getChangesets())\n      ->setViewer($viewer)\n      ->setFormat('git');\n\n    return $renderer->buildPatch();\n  }\n\n}\n","sourceCodeStart":24,"sourceCodeEnd":54,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialGetRawDiffConduitAPIMethod.php#L24-L54","documentation":"Thrown by the differential.getrawdiff Conduit method. It loads the diff identified by the diffID parameter with a viewer-policy-filtered DifferentialDiffQuery (changesets attached) and renders it in git format via DifferentialRawDiffRenderer; if no diff is found, ConduitException('ERR_NOT_FOUND') is thrown before rendering.","triggerScenarios":"Calling differential.getrawdiff with a diffID that does not exist, is zero/null, or names a diff the acting user cannot see under policy.","commonSituations":"Scripts exporting raw patches by ID where the ID was transcribed incorrectly or the diff was superseded/pruned; tokens from users without visibility on the owning revision's diff.","solutions":["Confirm the diff exists first with differential.getdiff using the same diffID","Use IDs taken directly from live API responses rather than manual transcription","Run the call with a token whose user can see the parent revision and its diffs","Catch ERR_NOT_FOUND and skip that export item rather than aborting the batch"],"exampleFix":"// before\n$params = array('diffID' => 'D91');\n\n// after\n$params = array('diffID' => 91);","handlingStrategy":"try-catch","validationCode":"try {\n  $probe = $client->callMethodSynchronous('differential.getdiff',\n    array('diff_id' => (int)$did));\n} catch (ConduitClientException $ex) {\n  throw new InvalidArgumentException('Unknown diff ID '.$did, 0, $ex);\n}","typeGuard":null,"tryCatchPattern":"try {\n  $patch = $client->callMethodSynchronous('differential.getrawdiff',\n    array('diffID' => (int)$did));\n} catch (ConduitClientException $ex) {\n  if ($ex->getErrorCode() === 'ERR_NOT_FOUND') {\n    continue; // batch export: skip this diff\n  }\n  throw $ex;\n}","preventionTips":["Take diff IDs from API responses, not manual transcription","Run exports with a token that can see the owning revision","Treat not-found as a skip in batch patch-export jobs"],"tags":["phabricator","conduit","differential","raw-diff","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}