{"record":{"id":"5e92ddc3296d02f1","repo":"emberjs/ember.js","slug":"unexpected-named-blocks-inside-name-chars-htm","errorCode":null,"errorMessage":"Unexpected named blocks inside <${name.chars}> HTML element (${printedNames})","messagePattern":"Unexpected named blocks inside <(.+?)> HTML element \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@glimmer/syntax/lib/v2/normalize.ts","lineNumber":990,"sourceCode":"  assertElement(name: SourceSlice, hasBlockParams: boolean): ASTv2.SimpleElement {\n    if (hasBlockParams) {\n      throw generateSyntaxError(\n        `Unexpected block params in <${name.chars}>: simple elements cannot have block params`,\n        this.loc\n      );\n    }\n\n    if (isPresentArray(this.namedBlocks)) {\n      let names = this.namedBlocks.map((b) => b.name);\n\n      if (names.length === 1) {\n        throw generateSyntaxError(\n          `Unexpected named block <:foo> inside <${name.chars}> HTML element`,\n          this.loc\n        );\n      } else {\n        let printedNames = names.map((n) => `<:${n.chars}>`).join(', ');\n        throw generateSyntaxError(\n          `Unexpected named blocks inside <${name.chars}> HTML element (${printedNames})`,\n          this.loc\n        );\n      }\n    }\n\n    return this.el.simple(name, this.nonBlockChildren, this.loc);\n  }\n\n  assertComponent(\n    name: string,\n    table: BlockSymbolTable,\n    hasBlockParams: boolean\n  ): PresentArray<ASTv2.NamedBlock> {\n    if (isPresentArray(this.namedBlocks) && this.hasSemanticContent) {\n      throw generateSyntaxError(\n        `Unexpected content inside <${name}> component invocation: when using named blocks, the tag cannot contain other content`,\n        this.loc","sourceCodeStart":972,"sourceCodeEnd":1008,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/syntax/lib/v2/normalize.ts#L972-L1008","documentation":"Same rule as the single-named-block case: plain HTML elements cannot contain any named blocks. When more than one named block (<:a>, <:b>, ...) appears inside an HTML element, the compiler reports all offending block names to help locate the mistake.","triggerScenarios":"Compiling a template with two or more named blocks inside a plain HTML element, e.g. <div><:a>x</:a><:b>y</:b></div> — assertElement builds printedNames from the block names and throws.","commonSituations":"Mistaking an HTML tag for a component invocation (e.g. writing <ul> instead of <Ul> or <MyList>), or authoring wrapper markup by hand that mimics yieldable component syntax.","solutions":["Convert the tag to a component invocation if blocks are intended (capitalize/namespace the name)","Remove the named blocks and put content directly inside the element","Split content into multiple elements instead of named blocks"],"exampleFix":"// before\n<section>\n  <:header>Title</:header>\n  <:body>Content</:body>\n</section>\n// after\n<Section>\n  <:header>Title</:header>\n  <:body>Content</:body>\n</Section>","handlingStrategy":"validation","validationCode":"function hasMultipleNamedBlocksInElement(template) {\n  const m = template.match(/<:\\w+>/g) || [];\n  return m.length > 1;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When wrappers are needed, create a real component instead of faking blocks on HTML tags","Keep capitalized component names so block syntax reads correctly","Lint templates for `<:name>` occurrences inside lowercase tags"],"tags":["glimmer","handlebars","named-blocks","template-syntax"],"backgroundTag":"named-block-in-html-element","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}