Lanuage negotiation notice: undefined index in getLangcode

Created on 19 December 2018, over 6 years ago
Updated 10 March 2025, about 2 months ago

When makes changes to the languages (more specificially changing the language negotiation) in Drupal 8.6.2 I'm getting multiple notices. Check out the screenshot for the error.

This is an error after using the Drupal 8.6.2 environment for a couple of weeks. This means the error could happen for a variety of reasons.
The fix I'm proposing is a simple check for the index, which is mostly harmless, but will remove the notice.

🐛 Bug report
Status

Closed: outdated

Version

9.4

Component

language.module

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇬🇧United Kingdom Rory Downes

    Hi,
    I have seen this issue with a Drupal 10.4.3 site. I don't have the domain module. It happens when I add a language and Drupal is going through the batch process of adding translations.

    I also tried it on a vanilla Drupal site (10.4.4) with just admin_toolbar and key modules added and the issue does not occur. So perhaps one of the many modules that I am using cause this.

    To get going for now with dev work I used the patch on comment 5 but had to improve on it as there are more places where $config['source'] is checked. I am not saying this is the solution but may help others in their dev environment add a language.

    Regards Rory

Production build 0.71.5 2024