TypeError when visiting 4xx pages

Created on 19 May 2023, over 1 year ago
Updated 28 May 2023, over 1 year ago

Problem/Motivation

Drupal throws a 500 error for any 4xx exception(e.g. 404) with the following log message:
TypeError: metatag_generate_entity_all_tags(): Argument #1 ($entity) must be of type Drupal\Core\Entity\ContentEntityInterface, null given, called in /var/www/html/web/modules/contrib/metatag/metatag.module on line 634 in metatag_generate_entity_all_tags() (line 646 of /var/www/html/web/modules/contrib/metatag/metatag.module).

Note: This only happens when custom error pages are not set.

Steps to reproduce

1. Created a new Gitpod with 1.x-dev with Drupal 10 & Nuxt 3 (latest, recommended)
2. Navigated to /ce-api/node/some404page
3. "The website encountered an unexpected error. Please try again later."
4. Checked logs

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇷🇴Romania alex_ieremia

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

Comments & Activities

Production build 0.71.5 2024