Problem/Motivation
CanvasOverrideHooks::menuLocalTasksAlter() generates a URL for the POST-only HTMX endpoint canvas_override.node.canvas.reset.do (via Url::toString()) to wire the Reset tab's hx-post attribute. When that route is not (yet) in the router table, Symfony\Component\Routing\Exception\RouteNotFoundException escapes the hook and takes down every page that renders local tasks with an HTTP 500.
This is not hypothetical: any Drupal core or Drupal CMS site running an earlier canvas_override release (1.0.0-beta3 or older, which predates the reset HTMX route) hits it on update. A composer update deployed before the cache/router rebuild runs — the normal ordering for containerized deploys — leaves a window where every node page 500s with:
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "canvas_override.node.canvas.reset.do" does not exist. Drupal\canvas_override\Hook\CanvasOverrideHooks->menuLocalTasksAlter() Drupal\Core\Menu\LocalTaskManager->getLocalTasks() Drupal\navigation\NavigationRenderer->getLocalTasks() …
A missing route for a decorative enhancement (the HTMX confirm shortcut; the tab's href still points at the standalone confirm form) should degrade gracefully, not fatal the site.
Steps to reproduce
- Install canvas_override 1.0.0-beta3 on a Drupal 11.4 site (plain core or Drupal CMS) and enable it.
- Replace the module code with 1.0.x HEAD (as composer would on deploy) without rebuilding caches.
- Visit any node page as an authenticated user with local tasks: HTTP 500 with the trace above, on every page, until
drush cr.
Proposed resolution
Wrap the reset-endpoint URL generation in a try/catch for RouteNotFoundException and skip the HTMX wiring when the route is unavailable — the tab keeps its normal href to the confirm form, and the site keeps rendering.
Remaining tasks
- ✅ File an issue about this project
- ✅ Addition/Change/Update/Fix to this project
- ✅ Testing to ensure no regression
- ✅ Automated unit/functional testing coverage
- ➖ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ✅ Reviewed by a human
- ✅ Code review by maintainers
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Update Release Notes
- ✅ Release canvas_override-1.0.0
User interface changes
- N/A
API changes
- N/A
Data model changes
- N/A
Release notes snippet
- Fixed a site-wide 500 (RouteNotFoundException) on pages with local tasks when the reset HTMX route is missing from the router, e.g. during a code update before caches are rebuilt.
Issue fork canvas_override-3621475
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rajab natshahComment #4
rajab natshahComment #5
rajab natshahMR !22 wraps the reset HTMX URL generation in menuLocalTasksAlter() in try/catch for RouteNotFoundException; when the route is missing from a stale router the tab now degrades to its normal href (the standalone confirm form) and the Edit-template-tab gating still runs, instead of a site-wide 500.
MR: https://git.drupalcode.org/project/canvas_override/-/merge_requests/22
AI-Generated: Yes (fix authored with Claude Code; reviewed by Rajab Natshah.)
Comment #7
rajab natshahComment #9
rajab natshahComment #10
rajab natshah