{"record":{"id":"3c0830dabd3f54a8","repo":"gohugoio/hugo","slug":"language-q-not-found","errorCode":null,"errorMessage":"language %q not found","messagePattern":"language %q not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/config.go","lineNumber":72,"sourceCode":"func (c *configCommand) Commands() []simplecobra.Commander {\n\treturn c.commands\n}\n\nfunc (c *configCommand) Name() string {\n\treturn \"config\"\n}\n\nfunc (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {\n\tconf, err := c.r.ConfigFromProvider(configKey{counter: c.r.configVersionID.Load()}, flagsToCfg(cd, nil))\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar config *allconfig.Config\n\tif c.lang != \"\" {\n\t\tvar found bool\n\t\tconfig, found = conf.configs.LanguageConfigMap[c.lang]\n\t\tif !found {\n\t\t\treturn fmt.Errorf(\"language %q not found\", c.lang)\n\t\t}\n\t} else {\n\t\tconfig = conf.configs.LanguageConfigMap[conf.configs.Base.DefaultContentLanguage]\n\t}\n\n\tvar buf bytes.Buffer\n\tdec := json.NewEncoder(&buf)\n\tdec.SetIndent(\"\", \"  \")\n\tdec.SetEscapeHTML(false)\n\n\tif err := dec.Encode(parser.ReplacingJSONMarshaller{Value: config, KeysToLower: true, OmitEmpty: !c.printZero}); err != nil {\n\t\treturn err\n\t}\n\n\tformat := strings.ToLower(c.format)\n\n\tswitch format {\n\tcase \"json\":","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/commands/config.go#L54-L90","documentation":"The hugo config --lang command looks up the given language code in the site's LanguageConfigMap (config.go:68-73). If the code is not among the languages defined in the site's languages configuration, this error is returned. When --lang is omitted, the default content language is used instead.","triggerScenarios":"Running hugo config --lang fr when 'fr' is not defined in the [languages] section of the site config.","commonSituations":"Typo in the language code; querying a language not enabled on the site; case mismatch between flag and config.","solutions":["Verify the language code exists in your languages configuration block","Omit --lang to use the default content language","Check for case sensitivity and trailing whitespace in the flag value"],"exampleFix":"# before\nhugo config --lang fr   # fr not in config\n# after: add the language to config\n[languages.fr]\nweight = 10\n# or just omit the flag\nhugo config","handlingStrategy":"validation","validationCode":"// Validate the --lang value against configured languages before running.\nfunc validateLanguage(lang string, configured map[string]bool) error {\n    if lang == \"\" {\n        return nil\n    }\n    if !configured[lang] {\n        return fmt.Errorf(\"language %q not found\", lang)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cross-check --lang values against the [languages] block in config","Omit --lang to use the default content language","List available languages with hugo config to avoid typos"],"tags":["cli","config","i18n","language","validation","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}