{"record":{"id":"03528e5b371e92e3","repo":"gohugoio/hugo","slug":"invalid-language-configuration-for-q","errorCode":null,"errorMessage":"invalid language configuration for %q","messagePattern":"invalid language configuration for %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/allconfig/allconfig.go","lineNumber":877,"sourceCode":"\t\tif l.C.transientErr != nil {\n\t\t\treturn l.C.transientErr\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (c *Configs) IsZero() bool {\n\t// A config always has at least one language.\n\treturn c == nil || len(c.Languages) == 0\n}\n\nfunc (c *Configs) Init(sourceFs afero.Fs, logger loggers.Logger) error {\n\tvar languages langs.Languages\n\n\tfor _, f := range c.Base.Languages.Config.Sorted {\n\t\tv, found := c.LanguageConfigMap[f.Name]\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"invalid language configuration for %q\", f.Name)\n\t\t}\n\t\tlanguage, err := langs.NewLanguage(f.Name, c.Base.DefaultContentLanguage, v.TimeZone, f.LanguageConfig, logger)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlanguages = append(languages, language)\n\t}\n\n\t// Filter out disabled languages.\n\tvar n int\n\tfor _, l := range languages {\n\t\tif !l.Disabled {\n\t\t\tlanguages[n] = l\n\t\t\tn++\n\t\t}\n\t}\n\tlanguages = languages[:n]\n","sourceCodeStart":859,"sourceCodeEnd":895,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/config/allconfig/allconfig.go#L859-L895","documentation":"Returned by Configs.Init when iterating over c.Base.Languages.Config.Sorted and a language name is not found in LanguageConfigMap. The sorted list is the source of truth for declared languages; a missing entry means the language was declared in one structure but never materialized in the per-language config map, leaving Init unable to construct a langs.Language.","triggerScenarios":"An inconsistency between the languages sorted list (typically populated from the `languages` config block) and LanguageConfigMap (built during config decode). Caused by partial config overrides, a custom config loader that mutates one structure but not the other, or a bug in a Hugo module that reorders languages.","commonSituations":"Multi-language sites with environment-specific config overlays that drop a language definition; theme+project config merges where the theme declares a language the project does not; experimental Hugo versions where the matrix/roles feature reshapes language config.","solutions":["Ensure every entry under `languages` has a matching per-language config block.","Re-check environment overrides (--environment) for partial language removal.","Disable the language cleanly via `disableLanguages` rather than deleting its block.","Run `hugo config --format toml` to dump and inspect the merged languages map."],"exampleFix":"// before\n[languages.en]\nweight = 1\n# (no [languages.fr] block but fr referenced elsewhere)\n// after\n[languages.en]\nweight = 1\n[languages.fr]\nweight = 2","handlingStrategy":"validation","validationCode":"func languagesConsistent(sorted []langSorted, m map[string]*langConfig) error {\n  for _, f := range sorted { if _, ok := m[f.Name]; !ok { return fmt.Errorf(\"language %q declared but not configured\", f.Name) } }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep every `languages.<code>` block paired with its config entry.","Disable languages via disableLanguages instead of deleting blocks.","After merging overlays, run `hugo config` to verify the languages map."],"tags":["config","languages","i18n","init","allconfig"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}