phacility/phabricator · error · Exception
Cache returned bogus result!
Error message
Cache returned bogus result!
What it means
Thrown by the 'bin/repository cache' workflow: the graph cache (PhabricatorRepositoryGraphCache) returned a cached last-modified commit ID, but DiffusionCommitQuery could not load a commit row with that ID. The cache holds a fast path over the authoritative commit table, so this means the cache contains a stale or bogus entry pointing at a commit that no longer exists, typically after history rewriting, repository re-creation, or partial data loss.
Source
Thrown at src/applications/repository/management/PhabricatorRepositoryManagementCacheWorkflow.php:80
$console = PhutilConsole::getConsole();
$console->writeOut(
"%s\n",
pht('Query took %s ms.', new PhutilNumber(1000 * ($t_end - $t_start))));
if ($cache_result === false) {
$console->writeOut("%s\n", pht('Not found in graph cache.'));
} else if ($cache_result === null) {
$console->writeOut(
"%s\n",
pht('Path not modified in any ancestor commit.'));
} else {
$last = id(new DiffusionCommitQuery())
->setViewer($this->getViewer())
->withIDs(array($cache_result))
->executeOne();
if (!$last) {
throw new Exception(pht('Cache returned bogus result!'));
}
$console->writeOut(
"%s\n",
pht(
'Path was last changed at %s.',
$commit->getRepository()->formatCommitName(
$last->getcommitIdentifier())));
}
return 0;
}
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Clear the repository graph cache so entries repopulate from the authoritative tables (flush the cache backend or use the repository cache-clearing maintenance), then re-run the command
- If commits were genuinely deleted by a history rewrite, verify commit table state and expect re-import work
- Verify cache backend health (Redis reachable, cache directory writable) if bogus values appear broadly
Defensive patterns
Strategy: fallback
Validate before calling
// Distrust cache hits that reference nonexistent commits:
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIDs(array($cached_id))
->executeOne();
if (!$commit) {
// treat the cache entry as bogus: bypass or flush and recompute from source data
} Try / catch
try {
$cached = $graph_cache->loadLastModifiedCommitID($commit_id, $path_id);
} catch (Exception $ex) {
if (preg_match('/bogus result/', $ex->getMessage())) {
// fall back to uncached computation after flushing the graph cache
}
} Prevention
- Flush graph caches whenever repository history is rewritten or repos are re-imported
- Keep cache backends and DB restores consistent: flush cache after a DB rollback
- Monitor for bogus-result errors as a canary for cache and DB divergence
When it happens
Trigger: Repository history rewritten (force-push or rebase) invalidating cached commit IDs; repository deleted and re-imported while the graph cache backend (Redis or files) kept old entries; commit rows removed by a repair script; cache key collision or corruption.
Common situations: Heavy history rewriting on Git repositories; restoring a Phabricator DB dump without flushing the matching cache backend; mixed cache state after switching cache configuration.
Related errors
- Specify either "--all" or "--caches", not both.
- Select caches to purge with "--all" or "--caches". Available
- Cache purger "%s" is not recognized. Available caches are: %
- When using "--caches", you must select at least one valid ca
- Specify a commit to look up with `%s`.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/febf74b08afe51dd.
Report an issue: GitHub.