phacility/phabricator · error · ConduitException
ERR_NOT_FOUND
ERR_NOT_FOUND
Error message
ERR_NOT_FOUND
What it means
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.
Source
Thrown at src/applications/differential/conduit/DifferentialGetRawDiffConduitAPIMethod.php:42
protected function defineErrorTypes() {
return array(
'ERR_NOT_FOUND' => pht('Diff not found.'),
);
}
protected function execute(ConduitAPIRequest $request) {
$diff_id = $request->getValue('diffID');
$viewer = $request->getUser();
$diff = id(new DifferentialDiffQuery())
->withIDs(array($diff_id))
->setViewer($viewer)
->needChangesets(true)
->executeOne();
if (!$diff) {
throw new ConduitException('ERR_NOT_FOUND');
}
$renderer = id(new DifferentialRawDiffRenderer())
->setChangesets($diff->getChangesets())
->setViewer($viewer)
->setFormat('git');
return $renderer->buildPatch();
}
}
View on GitHub (pinned to 5720a38cfe)
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
Example fix
// before
$params = array('diffID' => 'D91');
// after
$params = array('diffID' => 91); Defensive patterns
Strategy: try-catch
Validate before calling
try {
$probe = $client->callMethodSynchronous('differential.getdiff',
array('diff_id' => (int)$did));
} catch (ConduitClientException $ex) {
throw new InvalidArgumentException('Unknown diff ID '.$did, 0, $ex);
} Try / catch
try {
$patch = $client->callMethodSynchronous('differential.getrawdiff',
array('diffID' => (int)$did));
} catch (ConduitClientException $ex) {
if ($ex->getErrorCode() === 'ERR_NOT_FOUND') {
continue; // batch export: skip this diff
}
throw $ex;
} Prevention
- 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
When it happens
Trigger: Calling differential.getrawdiff with a diffID that does not exist, is zero/null, or names a diff the acting user cannot see under policy.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/b776cbd88a4bdefc.
Report an issue: GitHub.