Skip to content

Magento 2.4.6: ValueError DOMDocument::loadXML() Argument #1 ($source) must not be empty when rendering notification_area UI component

I’m encountering a critical error in my Magento 2.4.6-p13 installation when the admin panel tries to render the notification area. The error appears in the exception logs but doesn’t always break the page – it seems intermittent.

Error Details

[2025-11-19T07:07:44.087321+00:00] main.CRITICAL: ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty in /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php:322
Stack trace:
#0 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php(322): DOMDocument->loadXML('')
#1 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php(391): MagentoFrameworkViewElementUiComponentConfigDomMerger->createDomDocument('')
#2 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/Reader.php(60): MagentoFrameworkViewElementUiComponentConfigDomMerger->merge('')
#3 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/Reader.php(47): MagentoFrameworkViewElementUiComponentConfigReader->readFiles(Array)
#4 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): MagentoFrameworkViewElementUiComponentConfigReader->__construct(Object(MagentoFrameworkViewElementUiComponentConfigFileCollectorAggregatedFileCollector), Object(MagentoFrameworkViewElementUiComponentConfigConverter), Object(MagentoFrameworkViewElementUiComponentConfigDomMerger))
#5 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject('Magento\Framewo...', Array)
#6 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): MagentoFrameworkObjectManagerFactoryCompiled->create('Magento\Framewo...', Array)
#7 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/ReaderFactory.php(40): MagentoFrameworkObjectManagerObjectManager->create('Magento\Framewo...', Array)
#8 /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/Provider/Template.php(105): MagentoFrameworkViewElementUiComponentConfigReaderFactory->create(Array)
#9 /var/www/html/vendor/magento/framework/View/TemplateEngine/Xhtml.php(78): MagentoFrameworkViewElementUiComponentConfigProviderTemplate->getTemplate(false)
#10 /var/www/html/vendor/magento/framework/View/Element/UiComponent/ContentType/Xml.php(66): MagentoFrameworkViewTemplateEngineXhtml->render(Object(MagentoUiComponentListing), false)
#11 /var/www/html/vendor/magento/module-ui/Component/AbstractComponent.php(158): MagentoFrameworkViewElementUiComponentContentTypeXml->render(Object(MagentoUiComponentListing), 'templates/listi...')
#12 /var/www/html/vendor/magento/module-ui/Component/Wrapper/UiComponent.php(72): MagentoUiComponentAbstractComponent->render()
#13 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1128): MagentoUiComponentWrapperUiComponent->_toHtml()
#14 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1132): MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}()
#15 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(676): MagentoFrameworkViewElementAbstractBlock->_loadCache()
#16 /var/www/html/generated/code/Magento/Ui/Component/Wrapper/UiComponent/Interceptor.php(23): MagentoFrameworkViewElementAbstractBlock->toHtml()
#17 /var/www/html/vendor/magento/framework/View/Layout.php(591): MagentoUiComponentWrapperUiComponentInterceptor->toHtml()
#18 /var/www/html/vendor/magento/framework/View/Layout.php(553): MagentoFrameworkViewLayout->_renderUiComponent('notification_ar...')
#19 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('notification_ar...')
#20 /var/www/html/vendor/magento/framework/View/Layout.php(606): MagentoFrameworkViewLayout->renderElement('notification_ar...', false)
#21 /var/www/html/vendor/magento/framework/View/Layout.php(557): MagentoFrameworkViewLayout->_renderContainer('notifications', false)
#22 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('notifications')
#23 /var/www/html/vendor/magento/framework/View/Layout.php(606): MagentoFrameworkViewLayout->renderElement('notifications', false)
#24 /var/www/html/vendor/magento/framework/View/Layout.php(557): MagentoFrameworkViewLayout->_renderContainer('notices.wrapper', false)
#25 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('notices.wrapper')
#26 /var/www/html/vendor/magento/framework/View/Layout.php(606): MagentoFrameworkViewLayout->renderElement('notices.wrapper', false)
#27 /var/www/html/vendor/magento/framework/View/Layout.php(557): MagentoFrameworkViewLayout->_renderContainer('page.wrapper', false)
#28 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('page.wrapper')
#29 /var/www/html/vendor/magento/framework/View/Layout.php(606): MagentoFrameworkViewLayout->renderElement('page.wrapper', false)
#30 /var/www/html/vendor/magento/framework/View/Layout.php(557): MagentoFrameworkViewLayout->_renderContainer('backend.page', false)
#31 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('backend.page')
#32 /var/www/html/vendor/magento/framework/View/Layout.php(606): MagentoFrameworkViewLayout->renderElement('backend.page', false)
#33 /var/www/html/vendor/magento/framework/View/Layout.php(557): MagentoFrameworkViewLayout->_renderContainer('root', false)
#34 /var/www/html/vendor/magento/framework/View/Layout.php(510): MagentoFrameworkViewLayout->renderNonCachedElement('root')
#35 /var/www/html/vendor/magento/framework/View/Layout.php(975): MagentoFrameworkViewLayout->renderElement('root')
#36 /var/www/html/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): MagentoFrameworkViewLayout->getOutput()
#37 /var/www/html/vendor/magento/framework/View/Result/Page.php(260): MagentoFrameworkViewLayoutInterceptor->getOutput()
#38 /var/www/html/vendor/magento/framework/View/Result/Layout.php(171): MagentoFrameworkViewResultPage->render(Object(MagentoFrameworkAppResponseHttpInterceptor))
#39 /var/www/html/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(23): MagentoFrameworkViewResultLayout->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#40 /var/www/html/vendor/magento/framework/App/Http.php(120): MagentoBackendModelViewResultPageInterceptor->renderResult(Object(MagentoFrameworkAppResponseHttpInterceptor))
#41 /var/www/html/vendor/magento/framework/App/Bootstrap.php(264): MagentoFrameworkAppHttp->launch()
#42 /var/www/html/pub/index.php(30): MagentoFrameworkAppBootstrap->run(Object(MagentoFrameworkAppHttpInterceptor))
#43 {main} {"exception":"[object] (ValueError(code: 0): DOMDocument::loadXML(): Argument #1 ($source) must not be empty at /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php:322)"} []
[2025-11-19T07:07:44.625824+00:00] main.CRITICAL: ValueError: DOMDocument::loadXML(): Argument #1 ($source) must not be empty in /var/www/html/vendor/magento/framework/View/Element/UiComponent/Config/DomMerger.php:322
Stack trace:

Context

  • Magento Version: 2.4.6-p13
  • PHP Version: 8.2
  • Error occurs: When rendering admin notification area UI component
  • Frequency: Intermittent – appears multiple times in logs.

What I’ve Tried

  1. Searched for empty/malformed XML files:

    find app/code -path "*/ui_component/*.xml" -type f -exec sh -c 'if [ $(wc -c < "$1") -lt 100 ]; then echo "$1"; fi' _ {} ;
    

    No unusually small files found.

  2. Checked for custom overrides:

    grep -r "notification_area" app/code --include="*.xml"
    grep -r "notification_area" app/design --include="*.xml"
    

    No custom overrides of notification_area.xml found.

  3. Verified core file exists and is valid:

    cat vendor/magento/module-admin-notification/view/adminhtml/ui_component/notification_area.xml
    

    File exists and contains valid XML with proper <listing> structure.

  4. Checked for broken symlinks:

    find app/code -path "*/ui_component/*.xml" -type l
    

    No broken symlinks found.

Analysis

The stack trace shows:

  • DomMerger->merge('') is being called with an empty string at line #2
  • This happens during Reader->readFiles(Array) at line #3
  • The AggregatedFileCollector must be collecting a file that returns empty content
  • Specifically happening when rendering notification_area UI component

Questions

  1. How can I debug which file is returning empty content to the FileCollector? The readFiles() method receives an array of files – how do I log/inspect this array?

  2. Is this a known caching issue? Would clearing var/cache, var/page_cache, var/view_preprocessed, and generated/* resolve this?

  3. Could this be caused by a disabled module that previously declared a UI component extension that’s now referenced but file doesn’t exist?

  4. What’s the proper way to trace the UI component file collection process to find the problematic file?

Environment Details

  • Running in Docker with PHP-FPM 8.2
  • 60+ custom modules under app/code/
  • Custom admin theme at app/design/adminhtml/
  • No recent module enable/disable changes

What I Need

A systematic approach to:

  1. Identify which file path is returning empty content
  2. Understand why the FileCollector is including a non-existent or empty file
  3. Prevent this error from recurring after fix

Any guidance on debugging Magento 2’s UI Component file collection and merging process would be greatly appreciated.