{"record":{"id":"450b8501af2ab774","repo":"phacility/phabricator","slug":"commit-s-is-not-valid","errorCode":null,"errorMessage":"Commit \"%s\" is not valid.","messagePattern":"Commit \"(.+?)\" is not valid\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/differential/management/PhabricatorDifferentialExtractWorkflow.php","lineNumber":44,"sourceCode":"    if (!$extract) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a commit to extract the diff from.'));\n    }\n\n    if (count($extract) > 1) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify exactly one commit to extract.'));\n    }\n\n    $extract = head($extract);\n\n    $commit = id(new DiffusionCommitQuery())\n      ->setViewer($viewer)\n      ->withIdentifiers(array($extract))\n      ->executeOne();\n\n    if (!$commit) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Commit \"%s\" is not valid.',\n          $extract));\n    }\n\n    $diff = id(new DifferentialDiffExtractionEngine())\n      ->setViewer($viewer)\n      ->newDiffFromCommit($commit);\n\n    $uri = PhabricatorEnv::getProductionURI($diff->getURI());\n\n    echo tsprintf(\n      \"%s\\n\\n    %s\\n\",\n      pht('Extracted diff from \"%s\":', $extract),\n      $uri);\n  }\n\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/management/PhabricatorDifferentialExtractWorkflow.php#L26-L62","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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>)"],"exampleFix":"# before\nphabricator/ $ ./bin/differential extract abc123\nUsage Exception: Commit \"abc123\" is not valid.\n\n# after\nphabricator/ $ ./bin/differential extract rP703dcf56d0b6a4e01a52b1c6a1a1a8d1f8e2ab3c","handlingStrategy":"validation","validationCode":"// Confirm the commit is discoverable before extracting:\nphabricator/ $ ./bin/repository importing            # no pending rows for the repo\nphabricator/ $ ./bin/differential extract rP703dcf56d0b6a4e01a52b1c6a1a1a8d1f8e2ab3c","typeGuard":"// Accept only unambiguous identifiers:\npreg_match('/^r[A-Z]+[0-9a-f]{7,40}$|^[0-9a-f]{40}$/', $extract)","tryCatchPattern":"try {\n  $workflow->execute($args);\n} catch (PhutilArgumentUsageException $ex) {\n  // 'Commit ... is not valid' -> run discovery, wait for import, retry with full hash.\n}","preventionTips":["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>)"],"tags":["phabricator","differential","cli","extract","commit","not-found","diffusion"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}