{"record":{"id":"49e31620424a2db9","repo":"phacility/phabricator","slug":"unknown-circleci-build-type-s-expected-s-or","errorCode":null,"errorMessage":"Unknown CircleCI build type \"%s\". Expected \"%s\" or \"%s\".","messagePattern":"Unknown CircleCI build type \"(.+?)\"\\. Expected \"(.+?)\" or \"(.+?)\"\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php","lineNumber":172,"sourceCode":"    $token = $api_token->getSecret()->openEnvelope();\n    $parts = array(\n      'https://circleci.com/api/v1/project',\n      phutil_escape_uri($github_namespace),\n      phutil_escape_uri($github_name).\"?circle-token={$token}\",\n    );\n\n    $uri = implode('/', $parts);\n\n    $data_structure = array();\n    switch ($build_type) {\n      case 'tag':\n        $data_structure['tag'] = $build_identifier;\n        break;\n      case 'revision':\n        $data_structure['revision'] = $build_identifier;\n        break;\n      default:\n        throw new Exception(\n          pht(\n            'Unknown CircleCI build type \"%s\". Expected \"%s\" or \"%s\".',\n            $build_type,\n            'tag',\n            'revision'));\n    }\n\n    $data_structure['build_parameters'] = array(\n      'HARBORMASTER_BUILD_TARGET_PHID' => $build_target->getPHID(),\n    );\n\n    $json_data = phutil_json_encode($data_structure);\n\n    $future = id(new HTTPSFuture($uri, $json_data))\n      ->setMethod('POST')\n      ->addHeader('Content-Type', 'application/json')\n      ->addHeader('Accept', 'application/json')\n      ->setTimeout(60);","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/step/HarbormasterCircleCIBuildStepImplementation.php#L154-L190","documentation":"The buildable's getCircleCIBuildIdentifierType() must return exactly 'tag' (for commits) or 'revision' (for code review objects); the switch in execute() throws for any other value. This is a hard contract of HarbormasterCircleCIBuildableInterface, and the returned string is used to pick the JSON key ('tag' or 'revision') sent to the CircleCI API.","triggerScenarios":"A class implementing HarbormasterCircleCIBuildableInterface returns something else from getCircleCIBuildIdentifierType(): a typo, a case mismatch ('Revision'), or a newly invented type like 'branch'. Core Phabricator implementations only return 'tag' (PhabricatorRepositoryCommit) and 'revision' (DifferentialRevision).","commonSituations":"Third-party or custom applications add their own buildable objects and copy the interface incorrectly; refactoring renames the constants; the value is computed and an empty string is returned on an unhandled branch.","solutions":["Make getCircleCIBuildIdentifierType() return 'revision' for review objects or 'tag' for commit objects, exactly lowercase.","Audit every implementer of HarbormasterCircleCIBuildableInterface if you extend Phabricator, since the step accepts only these two values.","If you need a new identifier type, the step implementation itself must be extended to handle it before any implementer returns it."],"exampleFix":"// before\npublic function getCircleCIBuildIdentifierType() {\n  return 'branch';\n}\n\n// after\npublic function getCircleCIBuildIdentifierType() {\n  return 'revision';\n}","handlingStrategy":"type-guard","validationCode":"// In tests or step preconditions:\n$type = $object->getCircleCIBuildIdentifierType();\nif (!in_array($type, array('tag', 'revision'), true)) {\n  // do not run the CircleCI step for this buildable\n}","typeGuard":"function isValidCircleCIBuildIdentifierType($type) {\n  return in_array($type, array('tag', 'revision'), true);\n}","tryCatchPattern":null,"preventionTips":["Return only the literal strings 'tag' or 'revision' from getCircleCIBuildIdentifierType().","Add interface contract tests for every implementer of HarbormasterCircleCIBuildableInterface."],"tags":["harbormaster","circleci","build-type","interface","phabricator"],"backgroundTag":"invalid-enum-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}