{"record":{"id":"9f5da464c245ae1c","repo":"phacility/phabricator","slug":"no-such-repository-s","errorCode":null,"errorMessage":"No such repository \"%s\"!","messagePattern":"No such repository \"(.+?)\"!","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php","lineNumber":40,"sourceCode":"  protected function defineReturnType() {\n    return 'nonempty dict';\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $viewer = $request->getUser();\n    $raw_diff = $request->getValue('diff');\n    if ($raw_diff === null || !strlen($raw_diff)) {\n      throw new Exception(pht('Field \"raw_diff\" must be non-empty.'));\n    }\n\n    $repository_phid = $request->getValue('repositoryPHID');\n    if ($repository_phid) {\n      $repository = id(new PhabricatorRepositoryQuery())\n        ->setViewer($viewer)\n        ->withPHIDs(array($repository_phid))\n        ->executeOne();\n      if (!$repository) {\n        throw new Exception(\n          pht('No such repository \"%s\"!', $repository_phid));\n      }\n    }\n\n    $parser = new ArcanistDiffParser();\n    $changes = $parser->parseDiff($raw_diff);\n    $diff = DifferentialDiff::newFromRawChanges($viewer, $changes);\n\n    // We're bounded by doing INSERTs for all the hunks and changesets, so\n    // estimate the number of inserts we'll require.\n    $size = 0;\n    foreach ($diff->getChangesets() as $changeset) {\n      $hunks = $changeset->getHunks();\n      $size += 1 + count($hunks);\n    }\n\n    $raw_limit = 10000;\n    if ($size > $raw_limit) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php#L22-L58","documentation":"differential.createrawdiff optionally accepts repositoryPHID to attribute the diff to a repository. When supplied, the PHID is resolved with a viewer-filtered PhabricatorRepositoryQuery; if no repository matches, the method throws a plain Exception with 'No such repository \"%s!\"' naming the offending PHID.","triggerScenarios":"Passing a repository callsign (e.g. 'XYZ'), a monogram ('rXYZ'), a typo'd PHID, or a PHID of a repository the acting user cannot see; also a repository that was deleted.","commonSituations":"Tooling that identifies repos by callsign and forgets the conversion step; tokens belonging to users without repository visibility; stale PHIDs cached after a repository was renamed/deleted.","solutions":["Resolve the real PHID first with repository.query (by callsigns) and pass that value","Or omit repositoryPHID entirely - the server can often infer or accept the diff without it","Verify the PHID starts with 'PHID-REPO-'","Run the call with a token whose user can see the repository"],"exampleFix":"// before\n$params = array(\n  'diff' => $diff_text,\n  'repositoryPHID' => 'XYZ', // callsign, not a PHID\n);\n\n// after\n$repos = $client->callMethodSynchronous('repository.query', array(\n  'callsigns' => array('XYZ'),\n));\n$params = array(\n  'diff' => $diff_text,\n  'repositoryPHID' => head($repos)['phid'],\n);","handlingStrategy":"validation","validationCode":"// Resolve callsign -> PHID with the same token before calling.\n$repos = $client->callMethodSynchronous('repository.query',\n  array('callsigns' => array($callsign)));\nif (!$repos) {\n  throw new InvalidArgumentException('Unknown repository '.$callsign);\n}\n$params['repositoryPHID'] = head($repos)['phid'];\n// Or simply omit repositoryPHID.","typeGuard":null,"tryCatchPattern":"try {\n  $result = $client->callMethodSynchronous('differential.createrawdiff', $params);\n} catch (ConduitClientException $ex) {\n  if (strpos($ex->getMessage(), 'No such repository') !== false) {\n    unset($params['repositoryPHID']); // server can proceed without it\n    $result = $client->callMethodSynchronous('differential.createrawdiff', $params);\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Never send callsigns or monograms where a PHID is expected","Resolve repository identifiers once per run via repository.query","Omit repositoryPHID when inference is acceptable"],"tags":["phabricator","conduit","differential","repository","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}