{"record":{"id":"afae2278095bdd33","repo":"phacility/phabricator","slug":"no-field-with-field-key-s-exists-for-objects-of","errorCode":null,"errorMessage":"No field with field key \"%s\" exists for objects of class \"%s\" with custom field role \"%s\".","messagePattern":"No field with field key \"(.+?)\" exists for objects of class \"(.+?)\" with custom field role \"(.+?)\"\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php","lineNumber":61,"sourceCode":"\n    $object = newv($class, array());\n    $field_list = PhabricatorCustomField::getObjectFields($object, $role);\n\n    $field_key = $this->getParameter('key');\n    if (!strlen($field_key)) {\n      throw new Exception(pht('No custom field key specified.'));\n    }\n\n    $field = null;\n    foreach ($field_list->getFields() as $candidate_field) {\n      if ($candidate_field->getFieldKey() == $field_key) {\n        $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    }","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php#L43-L79","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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.","If the field was removed intentionally, delete or update the datasource wiring that references it.","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."],"exampleFix":"// before\n$datasource->setParameter('object', 'ManiphestTask');\n$datasource->setParameter('role', PhabricatorCustomField::ROLE_EDIT);\n$datasource->setParameter('key', 'std:maniphest:priorityy'); // typo\n// after\n$datasource->setParameter('key', 'std:maniphest:priority');","handlingStrategy":"validation","validationCode":"// Resolve the key against the live field list before loading results:\n$fields = PhabricatorCustomField::getObjectFields(\n  newv($class, array()), $role)->getFields();\n$exists = false;\nforeach ($fields as $field) {\n  if ($field->getFieldKey() === $field_key) { $exists = true; break; }\n}\nif (!$exists) {\n  throw new Exception('field key \"'.$field_key.'\" not found for '.$class);\n}","typeGuard":"function selectFieldExists($class, $role, $field_key) {\n  $fields = PhabricatorCustomField::getObjectFields(\n    newv($class, array()), $role)->getFields();\n  foreach ($fields as $field) {\n    if ($field->getFieldKey() === $field_key) {\n      return ($field instanceof PhabricatorStandardCustomFieldSelect)\n        || ($field->getProxy()\n          instanceof PhabricatorStandardCustomFieldSelect);\n    }\n  }\n  return false;\n}","tryCatchPattern":null,"preventionTips":["When a custom field is renamed or deleted, sweep all typeahead/datasource wiring for the old key in the same change.","Test datasource wiring per object class and role — a key valid for ROLE_EDIT may not exist under ROLE_VIEW.","Keep an inventory of field keys per extension so conflicts and stale references are found by grep."],"tags":["php","phabricator","custom-fields","typeahead","datasource"],"backgroundTag":"custom-field-datasource-misuse","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}