Changing mode from default to developer getting error

Changing mode from default to developer getting error

October 6, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Changing mode from default to developer getting error

Resolving Magento 2 Configuration Validation Errors After Setting Developer Mode

When trying to switch your Magento 2 store from default mode to developer mode using the bin/magento deploy:mode:set developer command, you might encounter configuration validation errors like the one described in the question above. These errors typically occur due to invalid XML attributes or syntax in your layout files.

Understanding the Error

The error message indicates that there are invalid attributes being used in your layout XML files within the app/design/frontend/{Vendor}/{Theme} directory of your Magento installation. The specific attributes causing issues here are:

  • cacheable on element <container>
  • type on element <block>
  • after on element <referenceContainer>

Resolving the Issue

To resolve these validation errors, you’ll need to update your layout XML files accordingly.

  1. Review Your Layout Files Open the relevant layout XML file in a text editor or use an IDE with XML support. The exact filename will depend on where the block is defined in your theme.

  2. Remove Invalid Attributes

    • For cacheable attribute: Remove this attribute from any <container> elements, as it’s not valid in Magento 2.

      <!-- Before -->
      <container name="header.container" cacheable="false">
        ...
      </container>
      
      <!-- After -->
      <container name="header.container">
        ...
      </container>
      
    • For type attribute: Remove this attribute from any <block> elements. The block type is determined by the as attribute in Magento 2.

      <!-- Before -->
      <block type="Magento\Cms\Block\Block" name="cms_block_cms_index_index" as="cmsBlockIndex" cacheable="false">
        ...
      </block>
      
      <!-- After -->
      <block name="cms_block_cms_index_index" as="cmsBlockIndex">
        ...
      </block>
      
    • For after attribute: Remove this attribute from any <referenceContainer> elements. The position of a block is determined by its placement within the layout structure.

      <!-- Before -->
      <referenceContainer name="content" after="-">
        <block ... />
      </referenceContainer>
      
      <!-- After -->
      <referenceContainer name="content">
        <block ... />
      </referenceContainer>
      

Best Practices to Avoid Future Errors

To prevent these issues in the future:

  • Always use official Magento documentation as a reference for layout XML syntax and attributes.
  • Use an XML editor or IDE that can validate your XML files against the schema provided by Magento.
  • Comment out or temporarily disable custom layout updates during development and testing of new features.

Conclusion

Resolving these configuration validation errors typically involves understanding the error message, locating the problematic file, and updating the layout XML according to Magento’s official syntax requirements. By following the steps outlined above and adhering to best practices for working with layout XML files in Magento 2, you can effectively resolve this issue and ensure a smooth transition between deployment modes.

For more detailed information on Magento 2 layout updates and best practices, refer to our comprehensive guide at https://laravelcompany.com/magento-2-layout-updates-guide.

Magento 2 Cache Themes Configuration

Our network