UnexpectedValueException for links without routes

Created on 14 August 2025, 1 day ago

Problem/Motivation

In πŸ› Update Layout Builder panel size Active , Patternkit added a link-alter hook to customize links with route "layout_builder.add_block". If that hook tries to process a link without a route, Drupal logs an error like this:

UnexpectedValueException: https://www.drupal.org has no corresponding route. in Drupal\Core\Url->getRouteName() (line 574 of /var/www/web/core/lib/Drupal/Core/Url.php).

Steps to reproduce

- Install Drupal 11.2 with standard profile
- Install Patternkit (latest release 9.1.x-dev)
- In Drupal, add a menu item to the main menu (e.g., at /admin/structure/menu/manage/main/add).
- Use this external URL for that link: "https://www.drupal.org"
- Save it
- Go to /admin/reports/dblog.
- Notice that you see an error message of type "patternkit", with the error metioned above.

Proposed resolution

See proposed MR.

Remaining tasks

Update tests?

πŸ› Bug report
Status

Active

Version

9.1

Component

Module Core

Created by

πŸ‡ΊπŸ‡ΈUnited States krisahil

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