#107432RuntimeException when creating new workspace version of sys_file_metadata records as editor
Description
Hello,
when creating a new workspace version of a sys_file_metadata record as a backend editor, TYPO3 throws a RuntimeException.
This happens because TYPO3 tries to check page permissions for the record. During this process, TYPO3 extracts the pid of the record and fetches the corresponding pages record from the database. However, sys_file_metadata records always have pid = 0. As a result, the database query for the pages record returns an empty array. Since this array does not contain a pid field, TYPO3 raises an exception.
Steps to reproduce
- Log in to the TYPO3 backend as an editor (non-admin). Editor has no LIVE workspace access and is assigned as valid user to a workspace.
- Navigate to the Filelist module.
- Select a file and open its metadata (from table sys_file_metadata).
- Change a value like title or description
- Save the records (which will try to create a new version of the metadata record).
Expected behavior
Creating a new workspace version of sys_file_metadata should work without errors. Since metadata records always have pid = 0, TYPO3 should handle this case gracefully without attempting to fetch a related pages record.
Actual behavior
TYPO3 throws the following exception:
(1/1) #1578950324 RuntimeException The given page record is invalid. Missing uid. in /vendor/typo3/cms-core/Classes/Authentication/BackendUserAuthentication.php line 329
Stack trace excerpt:
at TYPO3\CMS\Core\Authentication\BackendUserAuthentication->isInWebMount(array()) in /vendor/typo3/cms-core/Classes/DataHandling/DataHandler.php line 7620 ... at TYPO3\CMS\Core\DataHandling\DataHandler->hasPagePermission(1, array())
Additional information
The issue only occurs for editors (non-admin users).
sys_file_metadata records are always stored on pid = 0, which makes the page permission check invalid in this context.
As a result, TYPO3 receives an empty array instead of a valid pages record, leading to the RuntimeException.
Reviews 13
- 13.4 97239[BUGFIX] Let editors publish new root-level records
- 14.3 97238[BUGFIX] Let editors publish new root-level records
- main 97178[BUGFIX] Let editors publish new root-level records
- 13.4 95166[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- 14.3 95165[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- main 94880[BUGFIX] Defer BE_USER check in DataHandler::hasPageContextPermission
- main 95116[BUGFIX] Honor bypassAccessCheckForRecords without uid
- 13.4 94568[BUGFIX] Respect pid=0 and rooLevelRestriction in DH::versionizeRecord
- main 94311[BUGFIX] Respect pid=0 and rooLevelRestriction in DH::versionizeRecord
- 13.4 94633[BUGFIX] Refine exceptions to root-level restriction in DataHandler
- 14.3 94774[BUGFIX] Refine exceptions to root-level restriction in DataHandler
- main 94573[BUGFIX] Refine exceptions to root-level restriction in DataHandler
- 13.4 90469[BUGFIX] Fix access control for sys_file_metadata
Related issues 8
- Bug #106569Translation of file metadata not possible as editor
- Bug #106928Exception when an editor tries to delete file metadate translation
- Bug #107103\RuntimeException is thrown, when an editor tries to delete a redirect
- Bug #107379Editing of file metadata in workspace not possible as editor
- Bug #107905User can not create versioned sys_file_metadata from Workspaces
- Bug #108723Workspace preview actions interrupted by elements on root page
- Bug #110242DataHandler::hasPageContextPermission() denies admin / bypassAccessCheckForRecords when BE user uid is 0
- Bug #111259Non-admin editors cannot publish new records on root level (pid=0) in a workspace, e.g. sys_file_metadata placeholders
History 1523
-
Garvin Hicking commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-09-11T08:03:42+00:00" > 09/11/25, 08:03 </span> -
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-09-11T08:44:43+00:00" > 09/11/25, 08:44 </span>
Hi Garvin, I have this issue with TYPO3 13.4.18. My problem seems to be related somewhere in DataHandler::versionizeRecord, while your linked issue is more related to code in sys_history. Looks like a new issue IMO.
-
Stefan Froemken commented <span data-processor="relativetime" data-value="2025-09-18T09:31:00+00:00" > 09/18/25, 09:31 </span>
Some problem while setStage (Ready for publish) and publish. I have updated my current Hook:
<?php declare(strict_types=1); /* * This file is part of the package jweiland/[removed]. * * For the full copyright and license information, please read the * LICENSE file that was distributed with this source code. */ namespace JWeiland\SitePackage\Hook; use TYPO3\CMS\Core\DataHandling\DataHandler; /** * Because of a TYPO3 issue an editor cannot create a new version for his * workspace for sys_file_metadata records. * TYPO3 extracts the "pid" column from sys_file_metadata which is "0" by * default. So, retrieved pages record results in empty array. Because of missing "uid" * column the editor gets error: "The given page record is invalid. Missing uid." * * With this hook we temporarily allow an editor to create a new version of * sys_file_metadata records by bypassing the workspace permission check. * * If anything fails while customer session, please remove or comment the line with * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'] * from ext_localconf.php, flush cache, and you're done. * * link: https://forge.typo3.org/issues/107432 */ class DataHandlerHook { /** * Using processCmdmap_preProcess instead of processCmdmap hook is necessary here * because EXT:workspaces also hooks into processCmdmap. Since the loading order * cannot be controlled and EXT:workspaces is a core extension, our hook * implementation would never be executed before the workspaces hook. */ public function processCmdmap_preProcess( string $command, string $table, string|int $id, mixed $value, DataHandler $dataHandler, mixed $pasteUpdate ): void { if ($command !== 'version') { return; } if ($table !== 'sys_file_metadata') { return; } // setStage is needed for "Ready to publish" $action = $value['action'] ?? null; if (!in_array($action, ['new', 'setStage', 'publish'], true)) { return; } $dataHandler->bypassAccessCheckForRecords = true; } public function processCmdmap_postProcess( string $command, string $table, string|int $id, mixed $value, DataHandler $dataHandler, mixed $pasteUpdate, array $pasteDatamap ): void { if ($command !== 'version') { return; } if ($table !== 'sys_file_metadata') { return; } $dataHandler->bypassAccessCheckForRecords = false; } } -
Ulrich Mathes commented <span data-processor="relativetime" data-value="2025-12-15T15:34:03+00:00" > 12/15/25, 15:34 </span>
Can confirm this bug in TYPO3 v13.4.22
-
Peter Kraume changed Related to #106569 <span data-processor="relativetime" data-value="2026-03-30T21:10:28+00:00" > 03/30/26, 21:10 </span>
-
Peter Kraume changed Related to #106928 <span data-processor="relativetime" data-value="2026-03-30T21:10:35+00:00" > 03/30/26, 21:10 </span>
-
Peter Kraume changed Related to #107379 <span data-processor="relativetime" data-value="2026-03-30T21:10:40+00:00" > 03/30/26, 21:10 </span>
-
Peter Kraume changed Related to #107905 <span data-processor="relativetime" data-value="2026-03-30T21:10:44+00:00" > 03/30/26, 21:10 </span>
-
Peter Kraume commented <span data-processor="relativetime" data-value="2026-03-30T21:11:41+00:00" > 03/30/26, 21:11 </span>
Problem still present in TYPO3 v13.4.27
-
Peter Kraume changed Related to #107103 <span data-processor="relativetime" data-value="2026-03-30T21:38:17+00:00" > 03/30/26, 21:38 </span>
-
Gerrit Code Review pushed patch set 1 for main to change 94311 status
Needs FeedbackUnder Review <span data-processor="relativetime" data-value="2026-06-04T08:10:09+00:00" > 06/04/26, 08:10 </span> -
Gerrit Code Review pushed patch set 2 for main to change 94311 <span data-processor="relativetime" data-value="2026-06-04T08:50:47+00:00" > 06/04/26, 08:50 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 94568 <span data-processor="relativetime" data-value="2026-06-24T12:28:05+00:00" > 06/24/26, 12:28 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 94573 <span data-processor="relativetime" data-value="2026-06-28T06:43:43+00:00" > 06/28/26, 06:43 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 94633 <span data-processor="relativetime" data-value="2026-06-30T13:17:40+00:00" > 06/30/26, 13:17 </span>
-
Gerrit Code Review pushed patch set 2 for 13.4 to change 94633 <span data-processor="relativetime" data-value="2026-07-01T10:29:19+00:00" > 07/01/26, 10:29 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 94774 <span data-processor="relativetime" data-value="2026-07-14T08:31:22+00:00" > 07/14/26, 08:31 </span>
-
Gerrit Code Review pushed patch set 3 for 13.4 to change 94633 <span data-processor="relativetime" data-value="2026-07-14T08:33:52+00:00" > 07/14/26, 08:33 </span>
-
Oliver Hader commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-07-14T11:55:09+00:00" > 07/14/26, 11:55 </span>Applied in changeset commit:8f04953cb719cd9c2e5fad70cccc77766c68af8f.
-
Oliver Hader changed Related to #110242 <span data-processor="relativetime" data-value="2026-07-21T07:29:58+00:00" > 07/21/26, 07:29 </span>
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-08-11T08:46:41+00:00" > 08/11/26, 08:46 </span> -
Garvin Hicking changed Related to #111259 <span data-processor="relativetime" data-value="2026-10-27T20:30:46+00:00" > 10/27/26, 20:30 </span>
-
Benni Mack changed Related to #108723 <span data-processor="relativetime" data-value="2026-11-13T08:56:58+00:00" > 11/13/26, 08:56 </span>
Is this with 13.4.18? I think this bug was fixed there?! It sounds a lot like a duplicate of https://review.typo3.org/c/Packages/TYPO3.CMS/+/90469 or another patch I could not find right now with workspace relefance…