{"record":{"id":"552f8771058086ba","repo":"phacility/phabricator","slug":"circleci-did-not-return-a-s","errorCode":null,"errorMessage":"CircleCI did not return a \"%s\"!","messagePattern":"CircleCI did not return a \"(.+?)\"!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php","lineNumber":207,"sourceCode":"      ->addHeader('Accept', 'application/json')\n      ->setTimeout(60);\n\n    $this->resolveFutures(\n      $build,\n      $build_target,\n      array($future));\n\n    $this->logHTTPResponse($build, $build_target, $future, pht('CircleCI'));\n\n    list($status, $body) = $future->resolve();\n    if ($status->isError()) {\n      throw new HarbormasterBuildFailureException();\n    }\n\n    $response = phutil_json_decode($body);\n    $build_uri = idx($response, 'build_url');\n    if (!$build_uri) {\n      throw new Exception(\n        pht(\n          'CircleCI did not return a \"%s\"!',\n          'build_url'));\n    }\n\n    $target_phid = $build_target->getPHID();\n\n    // Write an artifact to create a link to the external build in CircleCI.\n\n    $api_method = 'harbormaster.createartifact';\n    $api_params = array(\n      'buildTargetPHID' => $target_phid,\n      'artifactType' => HarbormasterURIArtifact::ARTIFACTCONST,\n      'artifactKey' => 'circleci.uri',\n      'artifactData' => array(\n        'uri' => $build_uri,\n        'name' => pht('View in CircleCI'),\n        'ui.external' => true,","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php#L189-L225","documentation":"The POST to circleci.com/api/v1/project/... returned a non-error HTTP status and the body parsed as JSON, but the decoded object has no 'build_url' key. The step needs that URL to create the 'View in CircleCI' URI artifact, so a 2xx response without build_url (typically a JSON error object such as {\"message\": ...} from CircleCI) fails the build with this exception.","triggerScenarios":"CircleCI answers 200 with an error payload: project not enabled on CircleCI, token lacking scope for the project, or an API-shape change (the v1 API being deprecated/changed). Also possible with intermediaries (proxies) that return their own JSON on 2xx.","commonSituations":"The CircleCI project was never enabled ('Follow' the project on CircleCI); the token belongs to a different user/org; CircleCI v1 API behavior changed after maintenance; builds worked before a CircleCI or Phabricator upgrade.","solutions":["Open the build target log: logHTTPResponse() recorded the raw HTTP response, which shows exactly what CircleCI returned.","Confirm the project is enabled on CircleCI and the token has access to the namespace/project the step built.","Re-test the exact URL from the log with curl using the same token to reproduce the response outside Phabricator.","If CircleCI's API shape changed, update/patch HarbormasterCircleCIBuildStepImplementation or upgrade Phabricator."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sanity-check reachability before the build (optional, does not guarantee build_url):\nlist($status) = id(new HTTPSFuture('https://circleci.com/api/v1/me?circle-token='.$token))\n  ->resolve();\nif ($status->isError()) {\n  // token/project problem - fix before running builds\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run the CircleCI step\n} catch (Exception $ex) {\n  if (preg_match('/did not return a \"build_url\"/', $ex->getMessage())) {\n    // inspect the logged HTTP response body for the actual CircleCI payload;\n    // fix project/token config, then re-run the build\n  }\n}","preventionTips":["Enable ('Follow') the project on CircleCI before wiring the step.","Verify the token has access to the exact namespace/project the step derives from the GitHub path.","Keep Phabricator patched so CircleCI API changes are picked up; watch CircleCI deprecation notices for the v1 API."],"tags":["harbormaster","circleci","api","json","phabricator"],"backgroundTag":"api-response-schema-mismatch","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}