{"record":{"id":"c7a01393b0c36fc1","repo":"phacility/phabricator","slug":"unable-to-determine-how-to-clone-the-repository-fo","errorCode":null,"errorMessage":"Unable to determine how to clone the repository for this buildable: it is not associated with a tracked repository.","messagePattern":"Unable to determine how to clone the repository for this buildable: it is not associated with a tracked repository\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php","lineNumber":134,"sourceCode":"        'name' => pht('Use Blueprints'),\n        'type' => 'blueprints',\n        'required' => true,\n      ),\n      'repositoryPHIDs' => array(\n        'name' => pht('Also Clone'),\n        'type' => 'datasource',\n        'datasource.class' => 'DiffusionRepositoryDatasource',\n      ),\n    );\n  }\n\n  private function buildRepositoryMap(HarbormasterBuildTarget $build_target) {\n    $viewer = PhabricatorUser::getOmnipotentUser();\n    $variables = $build_target->getVariables();\n\n    $repository_phid = idx($variables, 'repository.phid');\n    if (!$repository_phid) {\n      throw new Exception(\n        pht(\n          'Unable to determine how to clone the repository for this '.\n          'buildable: it is not associated with a tracked repository.'));\n    }\n\n    $also_phids = $build_target->getFieldValue('repositoryPHIDs');\n    if (!is_array($also_phids)) {\n      $also_phids = array();\n    }\n\n    $all_phids = $also_phids;\n    $all_phids[] = $repository_phid;\n\n    $repositories = id(new PhabricatorRepositoryQuery())\n      ->setViewer($viewer)\n      ->withPHIDs($all_phids)\n      ->execute();\n    $repositories = mpull($repositories, null, 'getPHID');","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php#L116-L152","documentation":"buildRepositoryMap() reads the 'repository.phid' variable from the build target's build variables; when it is absent, the step cannot know which repository to clone and throws. The variable is only populated for buildables attached to a tracked Phabricator repository (e.g. a Differential revision with a repository set, or a repository commit).","triggerScenarios":"Running the 'Lease Working Copy' step on a buildable that is not associated with a repository: a Differential revision with no repository set (or a revision whose repository cannot be determined), or a build plan applied to an object type that never populates 'repository.phid'.","commonSituations":"Revisions imported without repository detection; builds triggered on paste/mock objects by an over-broad build plan; repository detection disabled or failing for the revision's callsign.","solutions":["Associate the buildable object with a tracked repository (set the repository on the Differential revision).","Restrict the build plan so it only runs against buildables of repository-backed objects.","If repository detection failed, fix the revision's repository field and re-run the build."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the variables a working-copy step depends on, before running:\n$variables = $build_target->getVariables();\nif (empty($variables['repository.phid'])) {\n  // buildable is not attached to a tracked repository - do not run the step\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only run working-copy steps in plans applied to repository-backed buildables.","Ensure Differential revisions have repository detection working so they get a repository."],"tags":["harbormaster","drydock","repository","phabricator"],"backgroundTag":"missing-required-configuration","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}