{"record":{"id":"1002f916df99e8fd","repo":"phacility/phabricator","slug":"build-target-s-has-the-wrong-type-of-build-st","errorCode":null,"errorMessage":"Build target (\"%s\") has the wrong type of build step. Only CircleCI build steps may be updated via the CircleCI webhook.","messagePattern":"Build target \\(\"(.+?)\"\\) has the wrong type of build step\\. Only CircleCI build steps may be updated via the CircleCI webhook\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/harbormaster/controller/HarbormasterCircleCIHookController.php","lineNumber":57,"sourceCode":"      if ($target) {\n        $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();\n        $this->updateTarget($target, $payload);\n      }\n    }\n\n    $response = new AphrontWebpageResponse();\n    $response->setContent(pht(\"Request OK\\n\"));\n    return $response;\n  }\n\n  private function updateTarget(\n    HarbormasterBuildTarget $target,\n    array $payload) {\n\n    $step = $target->getBuildStep();\n    $impl = $step->getStepImplementation();\n    if (!($impl instanceof HarbormasterCircleCIBuildStepImplementation)) {\n      throw new Exception(\n        pht(\n          'Build target (\"%s\") has the wrong type of build step. Only '.\n          'CircleCI build steps may be updated via the CircleCI webhook.',\n          $target->getPHID()));\n    }\n\n    switch (idx($payload, 'status')) {\n      case 'success':\n      case 'fixed':\n        $message_type = HarbormasterMessageType::MESSAGE_PASS;\n        break;\n      default:\n        $message_type = HarbormasterMessageType::MESSAGE_FAIL;\n        break;\n    }\n\n    $viewer = PhabricatorUser::getOmnipotentUser();\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/controller/HarbormasterCircleCIHookController.php#L39-L75","documentation":"CircleCI's counterpart of the Buildkite step-type check: updateTarget() loads the target's build step and requires the implementation to be HarbormasterCircleCIBuildStepImplementation. A CircleCI webhook payload that resolves to a target owned by any other step type (Buildkite, HTTP, script, ...) is rejected before its 'status' is mapped to pass/fail messages.","triggerScenarios":"A CircleCI notification carrying a build/step reference (query parameters on the hook URL) that points at a non-CircleCI target; swapping webhooks between the CircleCI and Buildkite endpoints; a plan whose step was changed after the build started; stale notifications for targets from an older plan revision.","commonSituations":"Configuring the CircleCI webhook on a repository whose Harbormaster plan uses a different CI step; replaying notifications after re-editing the plan; test payloads built from another step's target.","solutions":["Make sure the CircleCI webhook URL points at the CircleCI hook (harbormaster/circleci/) and references a target created by a CircleCI build step.","Open the build in the Harbormaster UI and confirm the target's step is a CircleCI step; if the plan changed, trigger a new build.","Re-send the notification only for targets that belong to CircleCI steps."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$impl = $target->getBuildStep()->getStepImplementation();\nif (!($impl instanceof HarbormasterCircleCIBuildStepImplementation)) {\n  // wrong hook for this target; do not apply the payload\n}","typeGuard":"function isCircleCITarget(HarbormasterBuildTarget $target) {\n  return $target->getBuildStep()->getStepImplementation()\n    instanceof HarbormasterCircleCIBuildStepImplementation;\n}","tryCatchPattern":null,"preventionTips":["Keep one webhook URL per CI provider and configure it only on projects whose Harbormaster plans use that provider's step.","After changing a plan's steps, trigger fresh builds so new targets match the new step types before old notifications arrive.","Validate step type in custom automation before pushing external build status into targets."],"tags":["harbormaster","circleci","webhook","step-type-mismatch"],"backgroundTag":"webhook-target-type-mismatch","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}