Module causes a fatal error on what would be 404 pages

Created on 24 March 2025, 19 days ago

Problem/Motivation

The website encountered an unexpected error. Try again later.

Symfony\Component\Routing\Exception\ResourceNotFoundException: No routes found for "/example-nonexistent-path". in Drupal\Core\Routing\Router->matchRequest() (line 150 of core/lib/Drupal/Core/Routing/Router.php).

Drupal\simple_admin_theme_by_route\EventSubscriber\AdminThemeSubscriber->onKernelRequest()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 157)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 201)
Drupal\page_cache\StackMiddleware\PageCache->fetch() (Line: 138)
Drupal\page_cache\StackMiddleware\PageCache->lookup() (Line: 87)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

  1. Enable module.
  2. Go to non-existent page.

Proposed resolution

Yes i'm filing this because my module https://www.drupal.org/project/admin_theme_by_content_type β†’ has the same problem! In ✨ Use admin theme for add and edit forms of some content types, but not all Active psf_ recommended implementing Theme Negotiator; is that what we need to do to avoid this problem? Or is there something else we can do in or around the Symfony\Component\HttpKernel\KernelEvents::REQUEST callback that can avoid this?

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mlncn Minneapolis, MN, USA

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024