{"record":{"id":"1097d49cbc56ecd3","repo":"emberjs/ember.js","slug":"unexpected-named-block-foo-inside-name-chars","errorCode":null,"errorMessage":"Unexpected named block <:foo> inside <${name.chars}> HTML element","messagePattern":"Unexpected named block <:foo> inside <(.+?)> HTML element","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@glimmer/syntax/lib/v2/normalize.ts","lineNumber":984,"sourceCode":"      name,\n      this.block.builder.block(table, this.nonBlockChildren, offsets),\n      this.loc\n    );\n  }\n\n  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,","sourceCodeStart":966,"sourceCodeEnd":1002,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/syntax/lib/v2/normalize.ts#L966-L1002","documentation":"In ASTv2 normalization, an HTML element (a tag that is not a component invocation) may not contain named blocks like <:default>, <:header> or <:foo>. Named blocks are only meaningful when invoking a component, so a single named block inside an HTML element is a syntax error.","triggerScenarios":"Compiling a template with exactly one named block inside a plain HTML element, e.g. <div><:foo>content</:foo></div> — the normalizer's assertElement path sees namedBlocks present on a SimpleElement.","commonSituations":"Accidentally writing <:yield>-style blocks inside plain tags, confusing named blocks with the {{yield}} helper, or copy-pasting component invocation markup into element markup.","solutions":["Remove the named block from inside the HTML element","Move the named block into a component invocation tag instead","Replace the named block with normal element content or {{yield}} inside a component template"],"exampleFix":"// before\n<div>\n  <:foo>hello</:foo>\n</div>\n// after\n<div>hello</div>","handlingStrategy":"validation","validationCode":"function hasNamedBlockInHtmlElement(template) {\n  return /<[a-z][^>]*>[\\s\\S]*<:\\w+>/.test(template);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember: named blocks only inside component invocation tags (capitalized/namespaced)","Use {{yield}} for content forwarding inside component templates, not <:block> in elements","Add ember-template-lint to catch this at lint time"],"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"}