phacility/phabricator · error · Exception

No field with field key "%s" exists for objects of class "%s

Error message

No field with field key "%s" exists for objects of class "%s" with custom field role "%s".

What it means

The datasource builds the field list for the given class and role, then scans for a field whose getFieldKey() equals the `key` parameter. If no field matches, it throws naming the field key, object class, and role — the three inputs that failed to line up.

Source

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

    $object = newv($class, array());
    $field_list = PhabricatorCustomField::getObjectFields($object, $role);

    $field_key = $this->getParameter('key');
    if (!strlen($field_key)) {
      throw new Exception(pht('No custom field key specified.'));
    }

    $field = null;
    foreach ($field_list->getFields() as $candidate_field) {
      if ($candidate_field->getFieldKey() == $field_key) {
        $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));
      }
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Dump the available keys for this class/role — iterate `PhabricatorCustomField::getObjectFields(newv($class, array()), $role)->getFields()` and compare getFieldKey() — then set `key` to one that exists.
  2. If the field was removed intentionally, delete or update the datasource wiring that references it.
  3. Make sure the role matches where the field is attached (a view-only field will not appear under ROLE_EDIT) and that the extension providing the field is enabled.

Example fix

// before
$datasource->setParameter('object', 'ManiphestTask');
$datasource->setParameter('role', PhabricatorCustomField::ROLE_EDIT);
$datasource->setParameter('key', 'std:maniphest:priorityy'); // typo
// after
$datasource->setParameter('key', 'std:maniphest:priority');
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the key against the live field list before loading results:
$fields = PhabricatorCustomField::getObjectFields(
  newv($class, array()), $role)->getFields();
$exists = false;
foreach ($fields as $field) {
  if ($field->getFieldKey() === $field_key) { $exists = true; break; }
}
if (!$exists) {
  throw new Exception('field key "'.$field_key.'" not found for '.$class);
}

Type guard

function selectFieldExists($class, $role, $field_key) {
  $fields = PhabricatorCustomField::getObjectFields(
    newv($class, array()), $role)->getFields();
  foreach ($fields as $field) {
    if ($field->getFieldKey() === $field_key) {
      return ($field instanceof PhabricatorStandardCustomFieldSelect)
        || ($field->getProxy()
          instanceof PhabricatorStandardCustomFieldSelect);
    }
  }
  return false;
}

Prevention

When it happens

Trigger: The `key` parameter has a typo or stale value: the field was renamed, its configuration entry removed from the custom-field config, it belongs to a different object class, or the role parameter selects a list that excludes this field (a field can appear for edit but not view roles).

Common situations: Renaming or deleting a custom field while old typeahead wiring still references its key; copying datasource wiring between object types; fields provided by a disabled extension so they no longer appear in the list.

Related errors


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