octobercms/october · error · SystemException
Display name cannot be empty.
Error message
Display name cannot be empty.
What it means
ReportDimensionField's constructor requires a non-empty display name, because it is shown in the report UI (column headers, filter labels). The check runs after code validation and throws a SystemException when $displayName has zero length.
Source
Thrown at modules/dashboard/classes/ReportDimensionField.php:59
* used directly, such as when it involves an aggregation function.
* @param bool $sortable Specifies if the field is sortable.
* @param bool $filterable Specifies if the field is filterable.
*/
public function __construct(
string $code,
string $displayName,
?string $columnName = null,
bool $sortable = false,
bool $filterable = false
) {
if (!strlen($code)) {
throw new SystemException('The dimension field code cannot be empty.');
}
self::validateCode($code);
if (!strlen($displayName)) {
throw new SystemException('Display name cannot be empty.');
}
$this->displayName = $displayName;
$this->sortable = $sortable;
$this->filterable = $filterable;
$this->code = $code;
$this->columnName = $columnName;
}
/**
* Returns the dimension field code.
* @return string Returns the dimension field code.
*/
public function getCode(): string
{
return $this->code;
}
View on GitHub (pinned to b608633a7e)
Solutions
- Ensure the display name resolves to a non-empty string for every locale (check the lang key exists)
- Fall back to a humanized version of the code: $config['name'] ?? ucwords(str_replace('_', ' ', substr($code, 9)))
- Fix the source configuration to always include a name
Example fix
// before
$field = new ReportDimensionField('oc_field_status', Lang::get('mystatusplugin::lang.status'));
// after
$name = Lang::get('mystatusplugin::lang.status');
if (!strlen(trim((string) $name))) {
$name = 'Status';
}
$field = new ReportDimensionField('oc_field_status', $name); Defensive patterns
Strategy: validation
Validate before calling
$displayName = trim((string) $config['name']);
if ($displayName === '') {
$displayName = ucwords(str_replace('_', ' ', substr($code, strlen('oc_field_'))));
}
$field = new ReportDimensionField($code, $displayName); Prevention
- Ship every locale's translation file — a missing lang key resolves to ''
- Fall back to a humanized code when the display name is empty
- Add a localization completeness check to CI
When it happens
Trigger: new ReportDimensionField('oc_field_status', '') — any constructor call where the second argument is an empty string.
Common situations: Lang keys that fail to resolve and return ''; config arrays missing the display-name key; localization files added for one locale but not another so the translated name is empty in the untranslated locale.
Related errors
- The dimension field code cannot be empty.
- Unknown dimension field specified:
- Invalid configuration. All keys must be non-empty strings an
- The dimension field code must have the oc_field_ prefix
- Unknown dimension type:
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/65e92fc1e258f723.
Report an issue: GitHub.