Skip to main content

Missing custom_layout_update_file attribute

This blog post might be outdated!
This blog post was published more than one year ago and might be outdated!
· One min read
Stephan Hochdörfer
Head of IT Business Operations

A while ago a merchant notified us that it was not possible anymore to edit categories in Magento. In the Magento logs, I found several similar error messages:

main.CRITICAL: Error: Call to a member function getAttributeCode() on boolean in
vendor/magento/module-catalog/Observer/InvalidateCacheOnCategoryDesignChange.php:
67

After adding some debug output, I realized that the attribute "custom_layout_update_file" was causing this issue. I checked in the database and the attribute did not exist. I could not find out why this attribute was missing, I added it again for both categories and products. After that, editing categories worked again.

These are the SQL Insert statements that I ran:

INSERT INTO eav_attribute (entity_type_id, attribute_code, attribute_model, backend_model, backend_type, backend_table, frontend_model, frontend_input, frontend_label, frontend_class, source_model, is_required, is_user_defined, default_value, is_unique, note) VALUES (4, 'custom_layout_update_file', null, 'Magento\\Catalog\\Model\\Product\\Attribute\\Backend\\LayoutUpdate', 'varchar', null, null, 'select', 'Custom Layout Update', null, 'Magento\\Catalog\\Model\\Product\\Attribute\\Source\\LayoutUpdate', 0, 0, null, 0, null);

INSERT INTO eav_attribute (entity_type_id, attribute_code, attribute_model, backend_model, backend_type, backend_table, frontend_model, frontend_input, frontend_label, frontend_class, source_model, is_required, is_user_defined, default_value, is_unique, note) VALUES (3, 'custom_layout_update_file', null, 'Magento\\Catalog\\Model\\Category\\Attribute\\Backend\\LayoutUpdate', 'varchar', null, null, 'select', 'Custom Layout Update', null, 'Magento\\Catalog\\Model\\Category\\Attribute\\Source\\LayoutUpdate', 0, 0, null, 0, null);