phacility/phabricator · error · Exception
No custom field key specified.
Error message
No custom field key specified.
What it means
The datasource requires a `key` parameter naming which custom field to offer typeahead options for. If `key` is missing or an empty string, loadResults throws immediately after building the field list.
Source
Thrown at src/infrastructure/customfield/datasource/PhabricatorStandardSelectCustomFieldDatasource.php:49
if (!$reflection->implementsInterface($interface)) {
throw new Exception(
pht(
'Custom field class "%s" does not implement interface "%s".',
$class,
$interface));
}
$role = $this->getParameter('role');
if (!strlen($role)) {
throw new Exception(pht('No custom field role specified.'));
}
$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));View on GitHub (pinned to 5720a38cfe)
Solutions
- Set `key` to the target field's getFieldKey() value (e.g. 'std:maniphest:priority' style keys for standard fields).
- Find the exact key by listing the object's fields (field list -> getFields() -> getFieldKey()) or from the field's configuration in Config → Custom Fields.
- Ensure the code path that computes the key cannot pass an empty string; default it explicitly.
Example fix
// before
$datasource->setParameter('key', '');
// after
$datasource->setParameter('key', 'std:maniphest:priority'); Defensive patterns
Strategy: validation
Validate before calling
$key = $datasource->getParameter('key');
if (!strlen((string)$key)) {
throw new Exception('datasource parameter "key" is required');
} Type guard
function hasCompleteSelectDatasourceParams($datasource) {
foreach (array('object', 'role', 'key') as $param) {
if (!strlen((string)$datasource->getParameter($param))) {
return false;
}
}
return true;
} Prevention
- Never derive `key` from unvalidated user/config input without a non-empty check.
- Discover keys programmatically from the field list rather than hardcoding, so renames surface as empty results, not wiring bugs.
When it happens
Trigger: Wiring the datasource with `object` and `role` but never setting `key`, or passing an empty string because the field key variable was null/typo'd when the parameter array was built.
Common situations: Function-wiring code that derives the key from configuration and silently yields '' when the config entry is missing; copy-paste datasource setup that drops one parameter; key constants renamed between versions.
Related errors
- Custom field class "%s" does not exist.
- Custom field class "%s" does not implement interface "%s".
- No custom field role specified.
- No field with field key "%s" exists for objects of class "%s
- Field "%s" is not a standard select field, nor a proxy of a
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/66e91e962472ba1b.
Report an issue: GitHub.