{"record":{"id":"edadcc5ad3f7dc98","repo":"gohugoio/hugo","slug":"permalinks-configuration-invalid-unknown-value-q","errorCode":null,"errorMessage":"permalinks configuration invalid: unknown value %q for key %q for kind %q","messagePattern":"permalinks configuration invalid: unknown value %q for key %q for kind %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"resources/page/permalinks.go","lineNumber":592,"sourceCode":"\t\t\tconfigs = append(configs,\n\t\t\t\tPermalinkConfig{Target: PageMatcher{Kind: kinds.KindPage, Path: sectionToPathGlob(k)}, Pattern: v},\n\t\t\t\tPermalinkConfig{Target: PageMatcher{Kind: kinds.KindTerm, Path: sectionToPathGlob(k)}, Pattern: v},\n\t\t\t)\n\n\t\tcase hmaps.Params:\n\t\t\t// [permalinks.kind]\n\t\t\t//   section = '...'\n\t\t\tif !hstrings.InSlice(permalinksKindsSupport, k) {\n\t\t\t\treturn nil, fmt.Errorf(\"permalinks configuration not supported for kind %q, supported kinds are %v\", k, permalinksKindsSupport)\n\t\t\t}\n\t\t\tfor k2, v2 := range v {\n\t\t\t\tswitch v2 := v2.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\tconfigs = append(configs,\n\t\t\t\t\t\tPermalinkConfig{Target: PageMatcher{Kind: k, Path: sectionToPathGlob(k2)}, Pattern: v2},\n\t\t\t\t\t)\n\t\t\t\tdefault:\n\t\t\t\t\treturn nil, fmt.Errorf(\"permalinks configuration invalid: unknown value %q for key %q for kind %q\", v2, k2, k)\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"permalinks configuration invalid: unknown value %q for key %q\", v, k)\n\t\t}\n\t}\n\treturn configs, nil\n}\n","sourceCodeStart":574,"sourceCodeEnd":602,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/page/permalinks.go#L574-L602","documentation":"Hugo throws this when decoding a `[permalinks.<kind>]` config table where a sub-key's value is not a string. The decoder in `decodePermalinksMap` only accepts string patterns for each section glob inside a kind table; any other type (number, list, nested map) is rejected before a `PermalinkConfig` is built. It is a hard config-load failure, not a warning.","triggerScenarios":"Calling config load / `hugo` build with a `permalinks` table like `[permalinks.page]` where an entry value is non-string, e.g. `posts = 123`, `posts = [\"a\",\"b\"]`, or `posts = { pattern = \"/x/\" }`. Reached via the `hmaps.Params` branch of the type switch at permalinks.go:585-594.","commonSituations":"YAML/TOML indentation slip making a value a table instead of a string; copy-pasting a numeric weight into the pattern slot; mixing the old flat `permalinks.key = 'pattern'` form with the new `[permalinks.kind]` form incorrectly; upgrading from an older Hugo that tolerated looser typing.","solutions":["Change every value inside `[permalinks.<kind>]` tables to be a single quoted string pattern, e.g. `posts = \"/posts/:slug/\"`.","Validate your `hugo.toml`/`config.yaml` permalinks block against the schema: each kind table maps section-glob to string.","Run `hugo config` to dump the parsed permalinks and confirm types render as strings.","Remove any nested maps or arrays under kind tables; move compound rules to separate section keys."],"exampleFix":"// hugo.toml -- before\n[permalinks.page]\nposts = 123\n\n// after\n[permalinks.page]\nposts = \"/posts/:slug/\"","handlingStrategy":"validation","validationCode":"// Pre-flight: load hugo.toml and check every [permalinks.<kind>] value is a string.\nimport (\n\t\"fmt\"\n\t\"github.com/spf13/viper\"\n)\nfunc validatePermalinksKind(cfg *viper.Viper) error {\n\tfor _, kind := range cfg.GetStringMap(\"permalinks\") {\n\t\tm, ok := kind.(map[string]any)\n\t\tif !ok { continue }\n\t\tfor _, v := range m {\n\t\t\tif _, ok := v.(string); !ok {\n\t\t\t\treturn fmt.Errorf(\"permalinks kind value must be string, got %T\", v)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint hugo.toml in CI with a schema checker before `hugo` runs.","Quote all permalink pattern strings in TOML/YAML.","Keep a single canonical permalinks form (prefer `[permalinks.kind]`)."],"tags":["config","permalinks","hugo","toml","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}