{"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":"error","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/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/page/permalinks.go#L574-L602","documentation":"Within a kind-scoped permalinks table like `[permalinks.page]`, every value must be a pattern string keyed by section glob. When a nested value is anything other than a string (e.g. another table, number, or list), decodePermalinksMap fails with this error, naming the offending value, key, and kind. Deeper nesting than two levels is not supported.","triggerScenarios":"`[permalinks.page.posts]` with further nested keys (making `posts` a map instead of a string), or `posts = 123` / `posts = [\"a\"]` under `[permalinks.page]`.","commonSituations":"Trying to nest per-subsection rules a level too deep; YAML indentation that turns a string into a mapping; unquoted values parsing as non-strings.","solutions":["Set each section key under the kind to a plain pattern string: `posts = '/:year/:slug/'`.","For per-subsection rules use path globs in the section key (e.g. `\"posts/tutorials\" = ...`) or switch to the slice format with `target.path`.","Quote YAML values so they parse as strings."],"exampleFix":"# before\n[permalinks.page.posts]\npattern = \"/:year/:slug/\"\n\n# after\n[permalinks.page]\nposts = \"/:year/:slug/\"","handlingStrategy":"validation","validationCode":"// use only documented tokens: :year :month :day :slug :title :section :sections :filename :slugorfilename :contentbasename ...\nre := regexp.MustCompile(`:[a-zA-Z]+`)\nknown := map[string]bool{\":year\": true, \":month\": true, \":day\": true, \":slug\": true, \":title\": true, \":section\": true, \":sections\": true, \":filename\": true, \":slugorfilename\": true}\nfor _, tok := range re.FindAllString(pattern, -1) {\n    if !known[tok] { /* invalid token */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the Hugo permalink token docs before using a :token — some tokens are only valid for certain kinds (e.g. date tokens need page dates)","Watch for typos like :slugs or :years","Test with `hugo --renderToMemory` in CI to catch config errors early"],"tags":["hugo","config","permalinks","type-error"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}