{"record":{"id":"d89581b54dd07deb","repo":"phacility/phabricator","slug":"unable-to-load-lease-with-id-s","errorCode":null,"errorMessage":"Unable to load lease with ID \"%s\"!","messagePattern":"Unable to load lease with ID \"(.+?)\"!","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/management/DrydockManagementCommandWorkflow.php","lineNumber":45,"sourceCode":"    if (!$lease_id) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Use \"--lease\" to specify a lease.'));\n    }\n\n    $argv = $args->getArg('argv');\n    if (!$argv) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a command to run.'));\n    }\n\n    $lease = id(new DrydockLeaseQuery())\n      ->setViewer($this->getViewer())\n      ->withIDs(array($lease_id))\n      ->executeOne();\n    if (!$lease) {\n      throw new Exception(\n        pht(\n          'Unable to load lease with ID \"%s\"!',\n          $lease_id));\n    }\n\n    // TODO: Check lease state, etc.\n\n    $interface = $lease->getInterface(DrydockCommandInterface::INTERFACE_TYPE);\n\n    list($stdout, $stderr) = call_user_func_array(\n      array($interface, 'execx'),\n      array('%Ls', $argv));\n\n    fwrite(STDOUT, $stdout);\n    fwrite(STDERR, $stderr);\n\n    return 0;\n  }","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementCommandWorkflow.php#L27-L63","documentation":"Thrown by `bin/drydock command` when a DrydockLeaseQuery for the given --lease ID returns no row. Either no lease with that numeric ID exists, or the lease is not visible to the viewer the management workflow uses. Note the workflow then goes straight to getInterface(DrydockCommandInterface::INTERFACE_TYPE), so leases of resource types without a command interface are also unusable here.","triggerScenarios":"`bin/drydock command --lease 9999 -- ls` where lease 9999 does not exist; passing a PHID or callsign instead of the numeric lease ID; referencing a lease the acting admin viewer cannot see.","commonSituations":"Reading the resource ID instead of the lease ID from the Drydock UI; stale lease IDs after leases were released and reclaimed; typos in automation scripts.","solutions":["Confirm the lease ID in the Drydock web UI (Leases list) or database and pass the numeric ID.","Remember it must be the lease ID, not the resource ID and not a PHID.","If the lease should exist, check it has not been released/destroyed and is visible to the viewer running the CLI."],"exampleFix":"# before (9999 does not exist / is a resource ID)\nbin/drydock command --lease 9999 -- git status\n\n# after (actual lease ID from the Drydock lease UI)\nbin/drydock command --lease 42 -- git status","handlingStrategy":"validation","validationCode":"$lease = id(new DrydockLeaseQuery())\n  ->setViewer($viewer)\n  ->withIDs(array($lease_id))\n  ->executeOne();\nif (!$lease) {\n  throw new InvalidArgumentException(\"No lease with ID {$lease_id}.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Capture the lease ID from the acquisition step (e.g. the output of `bin/drydock lease`) rather than transcribing it by hand.","Remember --lease takes the numeric lease ID, not a PHID and not the resource ID."],"tags":["drydock","phabricator","cli","lease","not-found"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}