{"record":{"id":"2498828ca3102218","repo":"gohugoio/hugo","slug":"permalinks-unsupported-config-type-t","errorCode":null,"errorMessage":"permalinks: unsupported config type %T","messagePattern":"permalinks: unsupported config type %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/permalinks.go","lineNumber":531,"sourceCode":"// DecodePermalinksConfig decodes the permalinks configuration.\n// It supports both the new slice-based format and the legacy map-based formats.\nfunc DecodePermalinksConfig(in any) (PermalinksConfig, error) {\n\tif in == nil {\n\t\treturn nil, nil\n\t}\n\n\tswitch v := in.(type) {\n\t// Check legacy formats first.\n\tcase map[string]any:\n\t\treturn decodePermalinksMap(v)\n\tcase hmaps.Params:\n\t\treturn decodePermalinksMap(v)\n\tdefault:\n\t\tif ms, err := hmaps.ToSliceStringMap(in); err == nil {\n\t\t\t// New slice format.\n\t\t\treturn decodePermalinksSlice(ms)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"permalinks: unsupported config type %T\", in)\n\t}\n}\n\nfunc decodePermalinksSlice(ms []map[string]any) (PermalinksConfig, error) {\n\tvar configs PermalinksConfig\n\tfor _, m := range ms {\n\t\tm = hmaps.CleanConfigStringMap(m)\n\t\tvar cfg PermalinkConfig\n\n\t\tif targetVal, ok := m[\"target\"]; ok {\n\t\t\tif err := mapstructure.WeakDecode(targetVal, &cfg.Target); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"permalinks: failed to decode target: %w\", err)\n\t\t\t}\n\t\t\tcfg.Target.Kind = strings.ToLower(cfg.Target.Kind)\n\t\t\tcfg.Target.Path = filepath.ToSlash(strings.ToLower(cfg.Target.Path))\n\t\t}\n\n\t\tif patternVal, ok := m[\"pattern\"]; ok {","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/page/permalinks.go#L513-L549","documentation":"Thrown by DecodePermalinksConfig when the raw permalinks config value is neither a map[string]any / hmaps.Params (legacy map format) nor convertible to []map[string]any (new slice format). It reports the concrete type, meaning the config shape itself is unrecognizable.","triggerScenarios":"The [permalinks] config section resolves to an unexpected type, e.g. a bare string, a number, or a list of scalars rather than a map or list of maps. Usually a config-loading or unmarshalling issue.","commonSituations":"Mistyping the permalinks config (e.g. 'permalinks = \"/:slug/\"' instead of a map), config migration errors, or a custom config provider returning the wrong Go type.","solutions":["Provide permalinks as either a map (section -> pattern) or a list of maps with target/pattern keys.","Check that your config provider/unmarshaller yields map[string]any or []map[string]any for the permalinks key.","Validate the config with 'hugo config' to see the resolved permalinks value."],"exampleFix":"# before (invalid)\npermalinks = \"/:year/:slug/\"\n# after\n[permalinks]\nposts = \"/:year/:slug/\"","handlingStrategy":"validation","validationCode":"switch in.(type) {\ncase map[string]any, hmaps.Params:\n    // map format\ninstance:\n    if _, err := hmaps.ToSliceStringMap(in); err != nil {\n        return fmt.Errorf(\"permalinks must be a map or list of maps\")\n    }\n}","typeGuard":"func isPermalinksConfigShape(in any) bool {\n    switch in.(type) {\n    case map[string]any, hmaps.Params:\n        return true\n    }\n    _, err := hmaps.ToSliceStringMap(in)\n    return err == nil\n}","tryCatchPattern":"cfg, err := page.DecodePermalinksConfig(raw)\nif err != nil { /* fix config root shape */ }","preventionTips":["Provide permalinks as a map (section->pattern) or list of target/pattern maps.","Avoid bare scalar values for the [permalinks] section.","Inspect resolved config with 'hugo config'."],"tags":["hugo","permalinks","configuration","type-mismatch"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}