phacility/phabricator · error · Exception
Got too many results (%s) for commit "%s", expected %s.
Error message
Got too many results (%s) for commit "%s", expected %s.
What it means
Thrown by PhabricatorRepositoryCommit::newCommitRef(), which calls the internal.commit.search Conduit method constrained to a single commit PHID inside one repository (src/applications/repository/storage/PhabricatorRepositoryCommit.php:537-567). Because PHIDs are globally unique, the result set must contain exactly one record; more than one means the storage or query layer returned duplicate commit rows for one PHID. This is an invariant/data-integrity violation, not a user mistake, and is effectively unreachable on a healthy install.
Source
Thrown at src/applications/repository/storage/PhabricatorRepositoryCommit.php:561
array(
'constraints' => array(
'repositoryPHIDs' => array($repository->getPHID()),
'phids' => array($this->getPHID()),
),
));
$result = $future->resolve();
$commit_display = $this->getMonogram();
if (empty($result['data'])) {
throw new Exception(
pht(
'Unable to retrieve details for commit "%s"!',
$commit_display));
}
if (count($result['data']) !== 1) {
throw new Exception(
pht(
'Got too many results (%s) for commit "%s", expected %s.',
phutil_count($result['data']),
$commit_display,
1));
}
$record = head($result['data']);
$ref_record = idxv($record, array('fields', 'ref'));
if (!$ref_record) {
throw new Exception(
pht(
'Unable to retrieve CommitRef record for commit "%s".',
$commit_display));
}
return DiffusionCommitRef::newFromDictionary($ref_record);View on GitHub (pinned to 5720a38cfe)
Solutions
- Check for duplicates: SELECT phid, COUNT(*) AS n FROM repository_commit GROUP BY phid HAVING n > 1;
- Deduplicate the rows (keep the canonical row), after taking a backup
- Verify the unique index on the phid column exists and repair the table
- If no duplicates exist, audit custom extensions that alter Diffusion commit search or conduit parameter handling
Example fix
-- before (diagnose) SELECT phid, COUNT(*) AS n FROM repository_commit GROUP BY phid HAVING n > 1; -- after (repair: keep the lowest id per PHID) DELETE c1 FROM repository_commit c1 JOIN repository_commit c2 ON c1.phid = c2.phid AND c1.id > c2.id;
Defensive patterns
Strategy: try-catch
Validate before calling
$rows = id(new DiffusionCommitQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs(array($commit->getPHID()))
->execute();
if (count($rows) !== 1) {
// integrity problem: do not call newCommitRef()
return;
} Try / catch
try {
$ref = $commit->newCommitRef($viewer);
} catch (Exception $ex) {
// Duplicate rows for one PHID: log the PHID and treat as a data-integrity
// incident; do not retry, the input cannot succeed until the DB is fixed.
phlog($ex);
throw new PhabricatorWorkerPermanentFailureException($ex->getMessage());
} Prevention
- Keep the unique index on repository_commit.phid intact; never bypass it with manual SQL
- Take consistent backups so partial restores cannot produce half-duplicated rows
- Audit any extension that alters conduit parameters for internal.commit.search
When it happens
Trigger: Calling $commit->newCommitRef($viewer) when the repository_commit table contains multiple rows with the same PHID (manual SQL edits, crashed migration, partial DB restore), or when a custom extension corrupts the constraints passed to internal.commit.search so more than one commit matches.
Common situations: Database restored from a partial or inconsistent backup; administrators duplicating commit rows with INSERT ... SELECT; third-party plugins hooking DiffusionQuery or the conduit layer. Never occurs during normal git/hg/svn import.
Related errors
- Certificate token points to an invalid user!
- Service "%s" is unrecognized, restricted, or you do not have
- Conduit API method "%s" does not exist.
- Method '%s' belongs to application '%s', which is not instal
- Specify a method to call with "--method".
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/70adb82ba35dc099.
Report an issue: GitHub.