{"record":{"id":"dd599a6c0880c80c","repo":"phacility/phabricator","slug":"field-s-is-not-a-standard-select-field-nor-a-p","errorCode":null,"errorMessage":"Field \"%s\" is not a standard select field, nor a proxy of a standard select field.","messagePattern":"Field \"(.+?)\" is not a standard select field, nor a proxy of a standard select field\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php","lineNumber":73,"sourceCode":"        $field = $candidate_field;\n        break;\n      }\n    }\n\n    if ($field === null) {\n      throw new Exception(\n        pht(\n          'No field with field key \"%s\" exists for objects of class \"%s\" with '.\n          'custom field role \"%s\".',\n          $field_key,\n          $class,\n          $role));\n    }\n\n    if (!($field instanceof PhabricatorStandardCustomFieldSelect)) {\n      $field = $field->getProxy();\n      if (!($field instanceof PhabricatorStandardCustomFieldSelect)) {\n        throw new Exception(\n          pht(\n            'Field \"%s\" is not a standard select field, nor a proxy of a '.\n            'standard select field.',\n            $field_key));\n      }\n    }\n\n    $options = $field->getOptions();\n\n    $results = array();\n    foreach ($options as $key => $option) {\n      $results[] = id(new PhabricatorTypeaheadResult())\n        ->setName($option)\n        ->setPHID($key);\n    }\n\n    return $this->filterResultsAgainstTokens($results);\n  }","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php#L55-L91","documentation":"This datasource exists specifically to enumerate options of select-type custom fields. After locating the field by key, it must be a PhabricatorStandardCustomFieldSelect — or a field whose getProxy() resolves to one (e.g. PhabricatorStandardCustomField wrapping a select via configuration). Anything else (text, date, user fields) throws.","triggerScenarios":"Pointing the datasource's `key` at a non-select custom field: a text field, a users field, a header field, or any standard field whose underlying proxy is not PhabricatorStandardCustomFieldSelect.","commonSituations":"A custom field's type was changed in the UI from select to text while the typeahead wiring kept using it; reusing the select datasource code for another field type by copy-paste; keys swapped during refactoring.","solutions":["Point `key` at a field configured with field type 'select' (its options are what get enumerated).","If the field must change type, remove or replace the datasource that references it.","In custom code, guard with `instanceof PhabricatorStandardCustomFieldSelect` (after getProxy()) before delegating."],"exampleFix":"// before: 'std:maniphest:owner' is a users field, not a select\n$datasource->setParameter('key', 'std:maniphest:owner');\n// after\n$datasource->setParameter('key', 'std:maniphest:priority');","handlingStrategy":"type-guard","validationCode":"$candidate = null;\nforeach ($fields as $field) {\n  if ($field->getFieldKey() === $field_key) { $candidate = $field; break; }\n}\nif (!($candidate instanceof PhabricatorStandardCustomFieldSelect)) {\n  $candidate = $candidate->getProxy();\n}\nif (!($candidate instanceof PhabricatorStandardCustomFieldSelect)) {\n  throw new Exception($field_key.' is not a select field; refusing');\n}","typeGuard":"function isSelectableCustomField($field) {\n  return ($field instanceof PhabricatorStandardCustomFieldSelect)\n    || ($field->getProxy()\n      instanceof PhabricatorStandardCustomFieldSelect);\n}","tryCatchPattern":null,"preventionTips":["Reserve this datasource for fields whose configured type is 'select'; pair each datasource instance with exactly one select field key.","If a field may change type over time, check isSelectableCustomField() before wiring the typeahead function.","When changing a field's type in the custom-field UI, remove dependent select datasources in the same edit."],"tags":["php","phabricator","custom-fields","typeahead","datasource","select-field"],"backgroundTag":"custom-field-datasource-misuse","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}