phacility/phabricator · error · Exception

Field "%s" is not a standard select field, nor a proxy of a

Error message

Field "%s" is not a standard select field, nor a proxy of a standard select field.

What it means

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.

Source

Thrown at src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php:73

        $field = $candidate_field;
        break;
      }
    }

    if ($field === null) {
      throw new Exception(
        pht(
          'No field with field key "%s" exists for objects of class "%s" with '.
          'custom field role "%s".',
          $field_key,
          $class,
          $role));
    }

    if (!($field instanceof PhabricatorStandardCustomFieldSelect)) {
      $field = $field->getProxy();
      if (!($field instanceof PhabricatorStandardCustomFieldSelect)) {
        throw new Exception(
          pht(
            'Field "%s" is not a standard select field, nor a proxy of a '.
            'standard select field.',
            $field_key));
      }
    }

    $options = $field->getOptions();

    $results = array();
    foreach ($options as $key => $option) {
      $results[] = id(new PhabricatorTypeaheadResult())
        ->setName($option)
        ->setPHID($key);
    }

    return $this->filterResultsAgainstTokens($results);
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Point `key` at a field configured with field type 'select' (its options are what get enumerated).
  2. If the field must change type, remove or replace the datasource that references it.
  3. In custom code, guard with `instanceof PhabricatorStandardCustomFieldSelect` (after getProxy()) before delegating.

Example fix

// before: 'std:maniphest:owner' is a users field, not a select
$datasource->setParameter('key', 'std:maniphest:owner');
// after
$datasource->setParameter('key', 'std:maniphest:priority');
Defensive patterns

Strategy: type-guard

Validate before calling

$candidate = null;
foreach ($fields as $field) {
  if ($field->getFieldKey() === $field_key) { $candidate = $field; break; }
}
if (!($candidate instanceof PhabricatorStandardCustomFieldSelect)) {
  $candidate = $candidate->getProxy();
}
if (!($candidate instanceof PhabricatorStandardCustomFieldSelect)) {
  throw new Exception($field_key.' is not a select field; refusing');
}

Type guard

function isSelectableCustomField($field) {
  return ($field instanceof PhabricatorStandardCustomFieldSelect)
    || ($field->getProxy()
      instanceof PhabricatorStandardCustomFieldSelect);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/dd599a6c0880c80c. Report an issue: GitHub.