{"record":{"id":"fd608f7217ab5493","repo":"gohugoio/hugo","slug":"goldmark-s","errorCode":null,"errorMessage":"goldmark: %s","messagePattern":"goldmark: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"markup/markup_config/config.go","lineNumber":52,"sourceCode":"\t// The configuration used by code highlighters.\n\tHighlight highlight.Config\n\n\t// Table of contents configuration\n\tTableOfContents tableofcontents.Config\n\n\t// Configuration for the Goldmark markdown engine.\n\tGoldmark goldmark_config.Config\n\n\t// Configuration for the AsciiDoc external markdown engine.\n\tAsciiDocExt asciidocext_config.Config\n\n\t// Configuration for the reStructuredText external markdown engine.\n\tRST rst_config.Config\n}\n\nfunc (c *Config) Init() error {\n\tif err := c.Goldmark.Init(); err != nil {\n\t\treturn fmt.Errorf(\"goldmark: %s\", err)\n\t}\n\tif err := c.RST.Init(); err != nil {\n\t\treturn fmt.Errorf(\"rst: %s\", err)\n\t}\n\treturn nil\n}\n\nfunc Decode(cfg config.Provider) (conf Config, err error) {\n\tconf = Default\n\n\tm := cfg.GetStringMap(\"markup\")\n\tif m == nil {\n\t\treturn\n\t}\n\tm = hmaps.CleanConfigStringMap(m)\n\n\tnormalizeConfig(m)\n","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/markup/markup_config/config.go#L34-L70","documentation":"Thrown by markup_config.Config.Init() when the Goldmark sub-config's own Init() returns an error. The underlying error is reformatted with the 'goldmark:' prefix using %s (string coercion, not %w wrapping), so errors.Is/As will NOT unwrap into it. Today Goldmark.Init() only runs Parser.Init() which migrates the deprecated AutoHeadingIDType field to AutoIDType, so a real failure here almost always points to a malformed [markup.goldmark] table that mapstructure decoded into an unexpected shape.","triggerScenarios":"Calling markup_config.Decode(cfg) with a hugo.yaml/toml that has a [markup.goldmark] block whose keys decode into incompatible types; specifically any value that breaks the Parser.Init migration or, in custom builds, any added Goldmark validation. Fires during site config load (hugo.Config from config.Provider).","commonSituations":"Upgrading Hugo across a major version where Goldmark config keys were renamed (e.g. AutoHeadingIDType -> AutoIDType in 0.144.0, typographer bool->struct in 0.112.0, footnote bool->struct in 0.151.0) and an old config still uses the legacy shape in a way the migrator in normalizeConfig did not catch. Hand-editing config with a typo or wrong nesting level under [markup.goldmark.parser].","solutions":["Inspect the full error chain printed after 'goldmark:' to see the concrete sub-message, then fix that specific Goldmark key in your config.","Run `hugo config` or `hugo --renderToMemory` to validate config parsing in isolation.","Compare your [markup.goldmark] block against the current Default in markup/goldmark/goldmark_config/config.go and remove/rename any deprecated keys.","If you do not need custom Goldmark settings, delete the [markup.goldmark] section entirely to fall back to defaults."],"exampleFix":"# before\n[markup.goldmark.parser]\n  autoHeadingIDType = \"github\"   # renamed to autoIDType in 0.144.0\n\n# after\n[markup.goldmark.parser]\n  autoIDType = \"github\"","handlingStrategy":"validation","validationCode":"// Validate the goldmark sub-config shape before calling Decode/Init.\nimport \"github.com/gohugoio/hugo/markup/goldmark/goldmark_config\"\n\nfunc validateGoldmark(g goldmark_config.Config) error {\n    switch g.Parser.AutoIDType {\n    case \"\", goldmark_config.AutoIDTypeGitHub, goldmark_config.AutoIDTypeGitHubAscii, goldmark_config.AutoIDTypeBlackfriday:\n    default:\n        return fmt.Errorf(\"goldmark.parser.autoIDType %q invalid\", g.Parser.AutoIDType)\n    }\n    return g.Init()\n}","typeGuard":null,"tryCatchPattern":"err := markupCfg.Init()\nif err != nil && strings.HasPrefix(err.Error(), \"goldmark:\") {\n    // config-shape problem; surface a clear message and the offending section\n    return fmt.Errorf(\"invalid [markup.goldmark] config: %w\", err)\n}","preventionTips":["Keep a golden hugo.toml under version control and diff against it after Hugo upgrades.","Read the changelog sections about markup/goldmark config renames before bumping Hugo major versions.","Run `hugo --renderToMemory` in CI to fail fast on config-shape errors."],"tags":["config","markup","goldmark","initialization"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}