Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver of core\lib\Drupal\Core\Asset\AssetResolver.php

Created on 19 July 2023, over 1 year ago


ā€¢	Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver->getCssAssets() (line 133 of core\lib\Drupal\Core\Asset\AssetResolver.php).
ā€¢	Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver->getJsAssets() (line 239 of core\lib\Drupal\Core\Asset\AssetResolver.php).
ā€¢	Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver->getJsAssets() (line 251 of core\lib\Drupal\Core\Asset\AssetResolver.php).
ā€¢	Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver->getJsSettingsAssets() (line 199 of core\lib\Drupal\Core\Asset\AssetResolver.php).


šŸ› Bug report
Status

Active

Version

9.5

Component
Asset libraryĀ  ā†’

Last updated 1 day ago

No maintainer
Created by

šŸ‡®šŸ‡³India rabindrakumar

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @rabindrakumar
  • šŸ‡®šŸ‡³India rabindrakumar

    The patch resolved the issue. I don't see any warning for this.

  • last update over 1 year ago
    Custom Commands Failed
  • Status changed to Postponed: needs info over 1 year ago
  • We need those steps to reproduce.

  • last update over 1 year ago
    Custom Commands Failed
  • Open in Jenkins ā†’ Open on Drupal.org ā†’
    Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    Custom Commands Failed
  • šŸ‡®šŸ‡³India rabindrakumar

    Hi Cilefen,

    This happened for me on Drupal 9.5.10 version and I am using PHP 8.1 and Database Version 10.4.25-MariaDB. My site was running with 9.5.9 and I started getting this warning after upgrading to 9.5.10 (Upgraded through composer).

  • Status changed to Needs review over 1 year ago
  • Status changed to Postponed: needs info over 1 year ago
  • šŸ‡ŗšŸ‡øUnited States smustgrave

    Leaving steps to reproduce as the actual steps are not provided.

    Also issue summary is incomplete.

    No test case either.

  • šŸ‡ŗšŸ‡øUnited States maskedjellybean Portland, OR

    The cause of this is an incorrectly formatted library name, likely in YOURTHEME.libraries.yml. Look for a library that does not follow this format: "MODULE_NAME/LIBRARY_NAME" (the forward slash is crucial). If you are able to step debug you could also add a breakpoint within \Drupal\Core\Asset\LibraryDependencyResolver::doGetDependencies (currently line 67). Refresh the page that triggers the error and continue debugging until you find that $library does not follow the correct format. Search your codebase for the incorrect format and replace it if it is in a custom module or theme. If it is in a contrib module, open an issue there.

    Perhaps the goal of this ticket could be to have core throw a useful error message when this happens?

  • šŸ‡ŗšŸ‡øUnited States timkroehler

    Can someone help me know how to make this patch application persist?
    I added these lines under /patches in composer.json, but the changes keep getting overwritten as I make changes in composer and update:

     "drupal/core": {
                    "3329660 - Assetresolver":
                        "https://www.drupal.org/files/issues/2022-12-26/3329660-2.patch"
                },
    
  • Status changed to Active 9 months ago
  • šŸ‡ŖšŸ‡øSpain eduardo morales alberti Spain, šŸ‡ŖšŸ‡ŗ

    In our case, this happens when the library does not exist on Drupal because was removed.

    Example of our case:

    A search Ajax callback with a library that was removed:
    https://example.com/search?ajax_page_state[theme]=radix&ajax_page_state[theme_token]=&ajax_page_state[libraries]=addtoany/addtoany.front&f[0]=type:article
    When the library does not exist or is not a valid name, then it gives a warning.
    Should be it fixed? Maybe not or maybe it should log which library is not available to leave to the admin decide what to do.

  • šŸ‡ŖšŸ‡øSpain eduardo morales alberti Spain, šŸ‡ŖšŸ‡ŗ

    Also covered the core/lib/Drupal/Core/Asset/LibraryDependencyResolver.php class, and continue if the extension or the name are not defined.

  • Pipeline finished with Success
    9 months ago
    Total: 520s
    #118077
  • šŸ‡ŖšŸ‡øSpain eduardo morales alberti Spain, šŸ‡ŖšŸ‡ŗ

    Added also array filter on HtmlResponseAttachmentsProcessor to avoid setting already loaded libraries when the array is empty.

    [0 = ""]
    
  • Pipeline finished with Success
    9 months ago
    Total: 492s
    #118101
  • šŸ‡µšŸ‡¹Portugal joao.ramos.costa

    #10 MR7016 reroll for D10.3.

  • šŸ‡®šŸ‡¹Italy giordy

    I have a similar warning with drupal 11.0.9 for every page visited. It must have appeared after one of the latest core updates.
    The site with drupal 10.3.10 has the same pages and settings, but there is no warning.
    I don't know how to fix it.

    Thank you

    Warning: Undefined array key 1 in Drupal\Core\Asset\AssetResolver->getJsAssets() (line 243 of /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/Asset/AssetResolver.php)
    
    #0 /home/hmcpdbiy/prova.gmpe.it/core/includes/bootstrap.inc(108): _drupal_error_handler_real(2, 'Undefined array...', '/home/hmcpdbiy/...', 243)
    #1 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/Asset/AssetResolver.php(243): _drupal_error_handler(2, 'Undefined array...', '/home/hmcpdbiy/...', 243)
    #2 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(286): Drupal\Core\Asset\AssetResolver->getJsAssets(Object(Drupal\Core\Asset\AttachedAssets), true, Object(Drupal\Core\Language\Language))
    #3 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(123): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object(Drupal\Core\Asset\AttachedAssets), Array)
    #4 /home/hmcpdbiy/prova.gmpe.it/core/modules/big_pipe/src/Render/BigPipeResponseAttachmentsProcessor.php(97): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse))
    #5 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse))
    #6 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/event-dispatcher/EventDispatcher.php(246): Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Symfony\Component\EventDispatcher\EventDispatcher))
    #7 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/event-dispatcher/EventDispatcher.php(206): Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response', Object(Symfony\Component\EventDispatcher\EventDispatcher))
    #8 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/event-dispatcher/EventDispatcher.php(56): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'kernel.response', Object(Symfony\Component\HttpKernel\Event\ResponseEvent))
    #9 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/http-kernel/HttpKernel.php(216): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ResponseEvent), 'kernel.response')
    #10 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/http-kernel/HttpKernel.php(204): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\Core\Render\HtmlResponse), Object(Symfony\Component\HttpFoundation\Request), 1)
    #11 /home/hmcpdbiy/prova.gmpe.it/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #12 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #13 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #14 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #15 /home/hmcpdbiy/prova.gmpe.it/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #16 /home/hmcpdbiy/prova.gmpe.it/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #17 /home/hmcpdbiy/prova.gmpe.it/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #18 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #19 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #20 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #21 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #22 /home/hmcpdbiy/prova.gmpe.it/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
    #23 /home/hmcpdbiy/prova.gmpe.it/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #24 {main}
  • šŸ‡¬šŸ‡§United Kingdom catch

    There's an MR here that needs work, changing status.

  • šŸ‡ŗšŸ‡¦Ukraine dlevchik

    #13 reroll for D10.4

Production build 0.71.5 2024