What happened?
Description
We are seeing repeated Craft CP failures when editors work with translated entries that contain deeply nested Matrix fields in blocks view mode.
The affected structure is roughly:
contentBlocks -> cards -> linkList / links
All of these are Matrix fields using viewMode: blocks.
From our logs, the failing request is always:
elements/update-field-layout
The error is:
yii\web\BadRequestHttpException: Invalid element UUID
The issue appears to happen when Craft tries to refresh the field layout for a nested Matrix entry, likely after a conditional field changes. In our case, the Card entry type has a Typ / cardType field that controls conditional fields such as linkList.
From checking Craft’s code, blocks mode renders nested Matrix entries as inline forms inside the parent form. With multiple nested Matrix levels, each block has its own form observer and can trigger elements/update-field-layout. That request sends the nested entry UUID, owner ID, field ID, type ID, and layout state. In the failing cases, Craft cannot resolve the nested UUID in the current owner/site/field context and returns Invalid element UUID.
Switching the same Matrix fields from blocks to cards avoided the issue in our local testing, because nested entries are then edited via card/slideout flow instead of deeply nested inline forms.
Relevant code paths we looked at:
craft\fields\Matrix::inputHtmlInternal()
craft\fields\Matrix::blockInputHtml()
craft\elements\NestedElementManager::getCardsHtml()
craft\controllers\ElementsController::actionUpdateFieldLayout()
craft\controllers\ElementsController::_element()
Craft version:
Steps to reproduce
- Create a Matrix field in
blocks view mode, e.g. contentBlocks.
- Add a Matrix entry type that contains another Matrix field, e.g.
cards, also in blocks view mode.
- Inside that nested Matrix entry type, add conditional fields controlled by an option/dropdown field, e.g.
cardType.
- Add another nested Matrix field behind one of those conditions, e.g.
links / linkList, also in blocks view mode.
- Edit a translated entry using this structure.
- Add or edit nested content under
contentBlocks -> cards -> linkList.
- Change the conditional field, e.g.
cardType.
- Observe the CP request to
elements/update-field-layout.
Expected behavior
Craft should refresh the conditional field layout for the nested Matrix entry without losing track of the nested element.
The editor should be able to continue editing translated nested Matrix content normally.
Actual behavior
Craft returns a 400 Bad Request from:
elements/update-field-layout
With:
yii\web\BadRequestHttpException: Invalid element UUID
The editor cannot continue reliably because the nested field layout refresh fails.
Additional context
We saw this repeatedly in production logs for translated sites.
The relevant log pattern:
yii\web\BadRequestHttpException: Invalid element UUID
/admin/actions/elements/update-field-layout
vendor/craftcms/cms/src/controllers/ElementsController.php
Local mitigation tested:
Changing the nested Matrix fields from blocks to cards stopped the failing update-field-layout requests in our tests.
Craft Matrix docs mention that blocks renders nested entries inline, while cards, card grid, and index open nested entries separately:
https://craftcms.com/docs/5.x/reference/field-types/matrix.html#view-mode
Craft CMS version
5.10.4.1
PHP version
8.5.7
Operating system and version
No response
Database type and version
PostgreSQL 17.10
Image driver and version
Imagick 3.8.1 (ImageMagick 6.9.11-60)
Installed plugins and versions
No response
What happened?
Description
We are seeing repeated Craft CP failures when editors work with translated entries that contain deeply nested Matrix fields in
blocksview mode.The affected structure is roughly:
All of these are Matrix fields using
viewMode: blocks.From our logs, the failing request is always:
The error is:
The issue appears to happen when Craft tries to refresh the field layout for a nested Matrix entry, likely after a conditional field changes. In our case, the Card entry type has a
Typ/cardTypefield that controls conditional fields such aslinkList.From checking Craft’s code,
blocksmode renders nested Matrix entries as inline forms inside the parent form. With multiple nested Matrix levels, each block has its own form observer and can triggerelements/update-field-layout. That request sends the nested entry UUID, owner ID, field ID, type ID, and layout state. In the failing cases, Craft cannot resolve the nested UUID in the current owner/site/field context and returnsInvalid element UUID.Switching the same Matrix fields from
blockstocardsavoided the issue in our local testing, because nested entries are then edited via card/slideout flow instead of deeply nested inline forms.Relevant code paths we looked at:
Craft version:
Steps to reproduce
blocksview mode, e.g.contentBlocks.cards, also inblocksview mode.cardType.links/linkList, also inblocksview mode.contentBlocks -> cards -> linkList.cardType.elements/update-field-layout.Expected behavior
Craft should refresh the conditional field layout for the nested Matrix entry without losing track of the nested element.
The editor should be able to continue editing translated nested Matrix content normally.
Actual behavior
Craft returns a
400 Bad Requestfrom:With:
The editor cannot continue reliably because the nested field layout refresh fails.
Additional context
We saw this repeatedly in production logs for translated sites.
The relevant log pattern:
Local mitigation tested:
Changing the nested Matrix fields from
blockstocardsstopped the failingupdate-field-layoutrequests in our tests.Craft Matrix docs mention that
blocksrenders nested entries inline, whilecards,card grid, andindexopen nested entries separately:https://craftcms.com/docs/5.x/reference/field-types/matrix.html#view-mode
Craft CMS version
5.10.4.1
PHP version
8.5.7
Operating system and version
No response
Database type and version
PostgreSQL 17.10
Image driver and version
Imagick 3.8.1 (ImageMagick 6.9.11-60)
Installed plugins and versions
No response