{"record":{"id":"9ddff25266f9636b","repo":"gohugoio/hugo","slug":"failed-to-parse-dimension-q-w","errorCode":null,"errorMessage":"failed to parse dimension %q: %w","messagePattern":"failed to parse dimension %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/page.go","lineNumber":535,"sourceCode":"func (ps *pageState) SiteVector() sitesmatrix.Vector {\n\treturn ps.s.siteVector\n}\n\nfunc (ps *pageState) siteVector() sitesmatrix.Vector {\n\treturn ps.s.siteVector\n}\n\nfunc (ps *pageState) siteVectors() sitesmatrix.VectorIterator {\n\treturn ps.s.siteVector\n}\n\n// Rotate returns all pages in the given dimension for this page.\nfunc (ps *pageState) Rotate(dimensionStr string) (page.Pages, error) {\n\tdimensionStr = strings.ToLower(dimensionStr)\n\tkey := ps.Path() + \"/\" + \"rotate-\" + dimensionStr\n\td, err := sitesmatrix.ParseDimension(dimensionStr)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse dimension %q: %w\", dimensionStr, err)\n\t}\n\n\tpages, err := ps.s.pageMap.getOrCreatePagesFromCache(ps.s.pageMap.cachePages2, key, func(string) (page.Pages, error) {\n\t\tvar pas page.Pages\n\t\tps.s.pageMap.treePages.ForEeachInDimension(ps.Path(), ps.s.siteVector, d,\n\t\t\tfunc(n contentNode) bool {\n\t\t\t\tif n != nil {\n\t\t\t\t\tp := n.(page.Page)\n\t\t\t\t\tpas = append(pas, p)\n\t\t\t\t}\n\t\t\t\treturn true\n\t\t\t},\n\t\t)\n\n\t\tif dimensionStr == \"language\" && ps.m.pageConfig.TranslationKey != \"\" {\n\t\t\t// translationKey set by user.\n\t\t\t// This is an old construct back from when languages were introduced.\n\t\t\t// We keep it for backward compatibility.","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/page.go#L517-L553","documentation":"Raised by pageState.Rotate (page.go:535) when sitesmatrix.ParseDimension cannot map the supplied dimension string. ParseDimension only accepts the known dimension names — 'language', 'version', 'role' (see sitesmatrix/dimensions.go). Anything else makes Rotate fail before it can walk the page tree.","triggerScenarios":"Calling `.Rotate` on a page in a template with an argument that isn't one of the supported dimensions, e.g. `{{ .Rotate \"output\" }}` or a typo like `{{ .Rotate \"langauge\" }}`. The value is lowercased first, but casing isn't the issue — vocabulary is.","commonSituations":"Misremembering the dimension name; guessing 'output'/'format' instead of the real names; passing a user-controlled string into Rotate without validation.","solutions":["Use one of the supported dimension names: \"language\", \"version\", or \"role\".","Check for typos — the string is lowercased but must still match exactly.","If the value is dynamic, validate it against the allow-list before calling Rotate."],"exampleFix":"// before\n{{ range .Rotate \"output\" }}...{{ end }}\n\n// after\n{{ range .Rotate \"language\" }}...{{ end }}","handlingStrategy":"validation","validationCode":"// allow-list the Rotate dimension before calling\nvar allowedDim = map[string]bool{\"language\": true, \"version\": true, \"role\": true}\n// if !allowedDim[dim] { return fmt.Errorf(\"unsupported dimension %q\", dim) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass 'language', 'version', or 'role' to .Rotate.","Validate user-supplied dimension strings against the allow-list."],"tags":["page","dimensions","rotate","templates"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}