Issue Bug Closed

#109257 FileList throws TypeError when TCA field has no label (LanguageService::translateLabel() receives null)

Robert Hafenried 03/16/26, 12:24 updated 03/31/26, 08:09

Description

Opening the file list module in the TYPO3 backend throws the following exception:
TypeError: TYPO3\CMS\Core\Localization\LanguageService::translateLabel():
Argument #2 ($fallback) must be of type string, null given,
called in vendor/typo3/cms-filelist/Classes/FileList.php on line 1716
Root cause:
In FileList::getFieldLabel() (line 1712–1716), the $label variable is retrieved via $schema->getField($field)->getLabel(), which can return null for TCA fields that have no label defined (e.g. internal fields like fileinfo, l10n_diffsource, crdate, foreign_table_parent_uid).
This null is then passed as the $fallback argument to LanguageService::translateLabel(), which since TYPO3 14 enforces a strict string type declaration on that parameter.
Affected code (FileList.php, line 1712–1716):
php$schema = $this->tcaSchemaFactory->has($concreteTableName) ? $this->tcaSchemaFactory->get($concreteTableName) : null;
$label = $schema?->hasField($field) ? $schema->getField($field)->getLabel() : null;
$tsConfig = BackendUtility::getPagesTSconfig(0);
$label = $lang->translateLabel(
$tsConfig[‘TCEFORM.’][$concreteTableName . ‘.’][$field . ‘.’][‘label.’] ?? [],
$tsConfig[‘TCEFORM.’][$concreteTableName . ‘.’][$field . ‘.’][‘label’] ?? $label // $label can be null here
);
Proposed fix:
Change line 1713 to fall back to an empty string instead of null:
php$label = $schema?->hasField($field) ? ($schema->getField($field)->getLabel() ?? ‘’) : ‘’;
Steps to reproduce:

Install TYPO3 14.x with any extension that adds TCA columns without a label key (or with extensions like ext:news, ext:ke_search, ext:impexp)
Open the backend file list module (Filelist > any folder)
TypeError is thrown immediately

Expected behavior:
File list renders without error; fields without a label are shown with an empty label string.
Actual behavior:
Fatal TypeError — file list module is completely unusable.
Workaround:
XCLASS on FileList that adds ?? ‘’ to the getLabel() call.

Reviews 2

Files 1

History 2024

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2026-03-19T08:11:30+00:00" > 03/19/26, 08:11 </span>

    Would you like to create a patch for review? Then it can be attributed to you and tested in the CI.

    Thanks!

  2. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-25T11:14:37+00:00" > 03/25/26, 11:14 </span>

    Yes, I’ll provide a patch – will submit it in the next days.

  3. Gerrit Code Review pushed patch set 1 for main to change 93355 status Needs Feedback Under Review <span data-processor="relativetime" data-value="2026-03-25T19:33:32+00:00" > 03/25/26, 19:33 </span>

  4. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-25T20:13:57+00:00" > 03/25/26, 20:13 </span>

    Thank you – I’m currently not able to reproduce the type error though. Could you tell me if I need a specific setup?

  5. Robert Hafenried commented and changed attached typo3-filelist-typeerror-stacktrace.txt <span data-processor="relativetime" data-value="2026-03-25T20:46:57+00:00" > 03/25/26, 20:46 </span>

    I can reproduce the error on a TYPO3 14.2.dev installation simply by opening the file list module (Filelist) in the backend. No specific extension is required – the stack trace shows the error occurs in FileList::getFieldLabel(). I’m attaching the full stack trace:
    TypeError: TYPO3\CMS\Core\Localization\LanguageService::translateLabel():
    Argument #2 ($fallback) must be of type string, null given, called in
    vendor/typo3/cms-filelist/Classes/FileList.php on line 1716
    TYPO3 Version: 14.2.dev
    PHP Version: 8.3

  6. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-26T09:50:43+00:00" > 03/26/26, 09:50 </span>

    I can’t reproduce that in my setup.

    Could you please check out your FieldList.php file and tell me what at line 489:

        protected function renderListTableFieldHeader(string $field): string
        {
            $label = $this->getFieldLabel($field);

    is contained in $field when this error is triggered? Did you maybe enhance sys_file with custom fields that have no labels?

    This would help me to better understand the fix.

  7. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-26T10:00:43+00:00" > 03/26/26, 10:00 </span>

    „The field is caption of sys_file_metadata. No custom fields have been added. Further debugging showed:

    TcaSchemaFactory::has(‘sys_file_metadata’) returns true
    $schema->hasField(‘caption’) returns false

    So the schema recognizes the table but does not recognize caption as a field, even though it is a standard sys_file_metadata field. This causes $label to be null, which is then passed to translateLabel().”

  8. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-26T11:31:45+00:00" > 03/26/26, 11:31 </span>

    Do you have EXT:filemetadata active and installed?

    If you go to https://yoursite/typo3/module/system/config?tree=tca and check sys_file_metadata -> colums -> caption – do you see label “filemetadata.db:sys_file_metadata.caption” referenced there?

    We’re getting closer! :) Thanks!

  9. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-26T11:45:36+00:00" > 03/26/26, 11:45 </span>

    Good question!

    EXT:filemetadata is not installed – there is no version compatible with TYPO3 14.2 yet (latest is for 14.1.1). So the caption field is apparently added to sys_file_metadata by EXT:filemetadata, which is missing in my setup. This explains why $schema->hasField(‘caption’) returns false.

  10. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-26T13:13:24+00:00" > 03/26/26, 13:13 </span>

    Do you use composeer? The extension is shipped in the core so it should match the base version you are using.

    Thats quite odd!

  11. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-26T15:10:04+00:00" > 03/26/26, 15:10 </span>

    Yes, it’s a ddev installation with composer.

  12. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-26T17:36:28+00:00" > 03/26/26, 17:36 </span>

    Whats your exact composer.json then? Filemetadata should have a dev-main alias too that you can use.

  13. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-26T18:10:07+00:00" > 03/26/26, 18:10 </span>

    {
    “name”: “typo3/cms-base-distribution”,
    “description”: “TYPO3 CMS Base Distribution”,
    “license”: “GPL-2.0-or-later”,
    “type”: “project”,
    “config”: {
    “allow-plugins”: {
    “typo3/class-alias-loader”: true,
    “typo3/cms-composer-installers”: true
    },
    “platform”: {
    “php”: “8.2.0“
    },
    “sort-packages”: true,
    “minimum-stability”: “dev”,
    “prefer-stable”: true
    },
    “require”: {
    “typo3/cms-backend”: “14.2.x-dev”,
    “typo3/cms-belog”: “14.2.x-dev”,
    “typo3/cms-beuser”: “14.2.x-dev”,
    “typo3/cms-core”: “14.2.x-dev”,
    “typo3/cms-dashboard”: “14.2.x-dev”,
    “typo3/cms-extbase”: “14.2.x-dev”,
    “typo3/cms-felogin”: “14.2.x-dev”,
    “typo3/cms-filelist”: “14.2.x-dev”,
    “typo3/cms-fluid”: “14.2.x-dev”,
    “typo3/cms-fluid-styled-content”: “14.2.x-dev”,
    “typo3/cms-form”: “14.2.x-dev”,
    “typo3/cms-frontend”: “14.2.x-dev”,
    “typo3/cms-impexp”: “14.2.x-dev”,
    “typo3/cms-info”: “14.2.x-dev”,
    “typo3/cms-install”: “14.2.x-dev”,
    “typo3/cms-reactions”: “14.2.x-dev”,
    “typo3/cms-recycler”: “14.2.x-dev”,
    “typo3/cms-rte-ckeditor”: “14.2.x-dev”,
    “typo3/cms-seo”: “14.2.x-dev”,
    “typo3/cms-setup”: “14.2.x-dev”,
    “typo3/cms-sys-note”: “14.2.x-dev”,
    “typo3/cms-tstemplate”: “14.2.x-dev”,
    “typo3/cms-viewpage”: “14.2.x-dev”,
    “typo3/cms-webhooks”: “14.2.x-dev”,
    “typo3/minimal”: “dev-main“
    },
    “repositories”: {
    “packages”: {
    “type”: “path”,
    “url”: “./packages/*“
    }
    }
    }

  14. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-27T09:43:17+00:00" > 03/27/26, 09:43 </span>

    I found the root cause: I’m using the database from a TYPO3 13 installation where EXT:filemetadata was installed. The field caption still exists in the database (sys_file_metadata.caption of type longtext), but since there is no compatible version of EXT:filemetadata for TYPO3 14.2, the extension is not installed and the field is not registered in TCA. This causes hasField(‘caption’) to return false and $label to be null.
    So this is not a general bug but a specific migration scenario. However, the patch would still protect against such situations where database fields exist but are not registered in TCA.

    After further investigation, I found the actual root cause: the field caption was stored as a selected display column in be_users.uc from the TYPO3 13 installation. Clearing the user configuration (UPDATE be_users SET uc = ‘’ WHERE uid = 1) resolved the issue immediately.
    So the trigger is not the database field itself, but a stale column selection in the backend user preferences referencing a field that no longer exists in TCA. The patch would still be a useful safeguard against this kind of situation.

  15. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-27T10:36:50+00:00" > 03/27/26, 10:36 </span>

    I came to the same conclusion and will provide an alternate patch.

  16. Robert Hafenried commented <span data-processor="relativetime" data-value="2026-03-27T10:47:57+00:00" > 03/27/26, 10:47 </span>

    Thanks for the more comprehensive fix! The root cause approach in setColumnsToRender() is much better than my symptom fix.

  17. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-27T16:28:25+00:00" > 03/27/26, 16:28 </span>

    Thanks so much for giving feedback here, that was well worth it! :)

  18. Robert Hafenried commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-03-29T09:20:13+00:00" > 03/29/26, 09:20 </span>

    Applied in changeset commit:4d0ac90fce3f8c63f23694ada2c46eec73da16e7.