phacility/phabricator · warning · PhutilArgumentUsageException
Commit "%s" is not valid.
Error message
Commit "%s" is not valid.
What it means
In ./bin/differential extract, the single commit argument is resolved through DiffusionCommitQuery->withIdentifiers()->executeOne(); if no imported, visible commit matches, the workflow throws 'Commit "%s" is not valid.' This is a lookup failure: the string may be well-formed but does not correspond to a discovered commit in Phabricator.
Source
Thrown at src/applications/differential/management/PhabricatorDifferentialExtractWorkflow.php:44
if (!$extract) {
throw new PhutilArgumentUsageException(
pht('Specify a commit to extract the diff from.'));
}
if (count($extract) > 1) {
throw new PhutilArgumentUsageException(
pht('Specify exactly one commit to extract.'));
}
$extract = head($extract);
$commit = id(new DiffusionCommitQuery())
->setViewer($viewer)
->withIdentifiers(array($extract))
->executeOne();
if (!$commit) {
throw new PhutilArgumentUsageException(
pht(
'Commit "%s" is not valid.',
$extract));
}
$diff = id(new DifferentialDiffExtractionEngine())
->setViewer($viewer)
->newDiffFromCommit($commit);
$uri = PhabricatorEnv::getProductionURI($diff->getURI());
echo tsprintf(
"%s\n\n %s\n",
pht('Extracted diff from "%s":', $extract),
$uri);
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Use the full hash or the r<REPO><hash> monogram so DiffusionCommitQuery resolves it uniquely
- Ensure discovery and import finished: './bin/repository discover --repoid <id>' and check './bin/repository importing' is empty
- Run as an admin or a viewer with access to the repository, then retry
- Confirm the commit exists in the hosted repository (git cat-file -t <hash>)
Example fix
# before phabricator/ $ ./bin/differential extract abc123 Usage Exception: Commit "abc123" is not valid. # after phabricator/ $ ./bin/differential extract rP703dcf56d0b6a4e01a52b1c6a1a1a8d1f8e2ab3c
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the commit is discoverable before extracting: phabricator/ $ ./bin/repository importing # no pending rows for the repo phabricator/ $ ./bin/differential extract rP703dcf56d0b6a4e01a52b1c6a1a1a8d1f8e2ab3c
Type guard
// Accept only unambiguous identifiers:
preg_match('/^r[A-Z]+[0-9a-f]{7,40}$|^[0-9a-f]{40}$/', $extract) Try / catch
try {
$workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
// 'Commit ... is not valid' -> run discovery, wait for import, retry with full hash.
} Prevention
- Extract only after discovery/parse daemons have processed the commit (check ./bin/repository importing)
- Use full hashes or r<REPO> monograms; short hashes can be ambiguous without repository context
- Verify the hash exists in the hosted repository first (git cat-file -t <hash>)
When it happens
Trigger: Hash that is ambiguous or short without repository context; commit not yet discovered/imported (repository discovery or daemons behind); repository invisible to the acting viewer; typo or wrong repo's hash; passing a branch or tag name instead of a commit identifier.
Common situations: Extracting immediately after a push before './bin/repository discover' and commit parsing complete; environments with paused daemons; administrators testing with hashes from a fork not hosted on the install.
Related errors
- Commit "%s" does not exist.
- Revision "%s" does not exist.
- Specify a commit to extract the diff from.
- Specify exactly one commit to extract.
- No hunk exists with ID "%s".
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/450b8501af2ab774.
Report an issue: GitHub.