{"record":{"id":"041eeff137597dfd","repo":"gohugoio/hugo","slug":"shortcode-has-no-name","errorCode":null,"errorMessage":"shortcode has no name","messagePattern":"shortcode has no name","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hugolib/shortcode.go","lineNumber":601,"sourceCode":"\t\t\tsc.indentation = item.ValStr(source)\n\t\t}\n\t}\n\n\tcnt := 0\n\tnestedOrdinal := 0\n\tnextLevel := level + 1\n\tclosed := false\n\tconst errorPrefix = \"failed to extract shortcode\"\n\nLoop:\n\tfor {\n\t\tcurrItem := pt.Next()\n\t\tswitch {\n\t\tcase currItem.IsLeftShortcodeDelim():\n\t\t\tnext := pt.Peek()\n\t\t\tif next.IsRightShortcodeDelim() {\n\t\t\t\t// no name: {{< >}} or {{% %}}\n\t\t\t\treturn sc, errors.New(\"shortcode has no name\")\n\t\t\t}\n\t\t\tif next.IsShortcodeClose() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif cnt > 0 {\n\t\t\t\t// nested shortcode; append it to inner content\n\t\t\t\tpt.Backup()\n\t\t\t\tnested, err := s.extractShortcode(nestedOrdinal, nextLevel, source, pt)\n\t\t\t\tnestedOrdinal++\n\t\t\t\tif nested != nil && nested.name != \"\" {\n\t\t\t\t\ts.addName(nested.name)\n\t\t\t\t}\n\n\t\t\t\tif err == nil {\n\t\t\t\t\tsc.inner = append(sc.inner, nested)\n\t\t\t\t} else {\n\t\t\t\t\treturn sc, err","sourceCodeStart":583,"sourceCodeEnd":619,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/hugolib/shortcode.go#L583-L619","documentation":"Thrown by shortcodeParseInfo.extractShortcode in hugolib/shortcode.go:601 when a left shortcode delimiter is immediately followed by a right delimiter with no name token. The parser sees {{< >}} or {{% %}} and aborts because a shortcode must name a template.","triggerScenarios":"Authoring Markdown content containing an empty shortcode tag {{< >}} or {{% %}}, or a partial edit that deleted the shortcode name but left the delimiters.","commonSituations":"Typing a shortcode and accidentally closing it before the name, find-and-replace that emptied a shortcode name, or copy-pasting a shortcode skeleton without filling it in.","solutions":["Search the offending content file (Hugo reports the file/line) for {{< >}} or {{% %}} and remove or complete the tag.","Replace with the intended shortcode, e.g. {{< figure src=\"x.jpg\" >}}.","If you meant a literal delimiter pair, escape it or use HTML entities."],"exampleFix":"// before\n{{< >}}\n// after\n{{< figure src=\"hero.jpg\" >}}","handlingStrategy":"validation","validationCode":"// Scan content for empty shortcode tags before build.\n// rg -n '\\\\{\\\\{<\\\\s*>\\\\}\\}|\\\\{\\\\{%\\\\s*%\\\\}\\}' content/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a pre-commit grep for empty shortcode delimiters in Markdown.","Use an editor snippet that always inserts a name placeholder inside {{< >}}.","Treat Hugo's file/line in the error as authoritative and fix at the source."],"tags":["shortcode","content","markdown","parsing"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}