{"record":{"id":"65e92fc1e258f723","repo":"octobercms/october","slug":"display-name-cannot-be-empty","errorCode":null,"errorMessage":"Display name cannot be empty.","messagePattern":"Display name cannot be empty\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/dashboard/classes/ReportDimensionField.php","lineNumber":59,"sourceCode":"     * used directly, such as when it involves an aggregation function.\n     * @param bool $sortable Specifies if the field is sortable.\n     * @param bool $filterable Specifies if the field is filterable.\n     */\n    public function __construct(\n        string $code,\n        string $displayName,\n        ?string $columnName = null,\n        bool $sortable = false,\n        bool $filterable = false\n    ) {\n        if (!strlen($code)) {\n            throw new SystemException('The dimension field code cannot be empty.');\n        }\n\n        self::validateCode($code);\n\n        if (!strlen($displayName)) {\n            throw new SystemException('Display name cannot be empty.');\n        }\n\n        $this->displayName = $displayName;\n        $this->sortable = $sortable;\n        $this->filterable = $filterable;\n        $this->code = $code;\n        $this->columnName = $columnName;\n    }\n\n    /**\n     * Returns the dimension field code.\n     * @return string Returns the dimension field code.\n     */\n    public function getCode(): string\n    {\n        return $this->code;\n    }\n","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/dashboard/classes/ReportDimensionField.php#L41-L77","documentation":"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.","triggerScenarios":"new ReportDimensionField('oc_field_status', '') — any constructor call where the second argument is an empty string.","commonSituations":"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.","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"],"exampleFix":"// before\n$field = new ReportDimensionField('oc_field_status', Lang::get('mystatusplugin::lang.status'));\n\n// after\n$name = Lang::get('mystatusplugin::lang.status');\nif (!strlen(trim((string) $name))) {\n    $name = 'Status';\n}\n$field = new ReportDimensionField('oc_field_status', $name);","handlingStrategy":"validation","validationCode":"$displayName = trim((string) $config['name']);\nif ($displayName === '') {\n    $displayName = ucwords(str_replace('_', ' ', substr($code, strlen('oc_field_'))));\n}\n$field = new ReportDimensionField($code, $displayName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["php","dashboard","report","dimension","field","validation","i18n"],"backgroundTag":"empty-required-argument","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}