{"record":{"id":"82b760aa25462b67","repo":"emberjs/ember.js","slug":"name-chars-is-not-a-valid-named-block-name","errorCode":null,"errorMessage":"<:${name.chars}/> is not a valid named block: named blocks cannot be self-closing","messagePattern":"<:(.+?)/> is not a valid named block: named blocks cannot be self-closing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@glimmer/syntax/lib/v2/normalize.ts","lineNumber":932,"sourceCode":"    }\n\n    return this.block.builder.block(table, this.nonBlockChildren, this.loc);\n  }\n}\n\nclass ElementChildren extends Children {\n  constructor(\n    private el: BuildElement,\n    loc: SourceSpan,\n    children: (ASTv2.ContentNode | ASTv2.NamedBlock)[],\n    block: BlockContext\n  ) {\n    super(loc, children, block);\n  }\n\n  assertNamedBlock(name: SourceSlice, table: BlockSymbolTable): ASTv2.NamedBlock {\n    if (this.el.base.selfClosing) {\n      throw generateSyntaxError(\n        `<:${name.chars}/> is not a valid named block: named blocks cannot be self-closing`,\n        this.loc\n      );\n    }\n\n    if (isPresentArray(this.namedBlocks)) {\n      throw generateSyntaxError(\n        `Unexpected named block inside <:${name.chars}> named block: named blocks cannot contain nested named blocks`,\n        this.loc\n      );\n    }\n\n    if (!isLowerCase(name.chars)) {\n      throw generateSyntaxError(\n        `<:${name.chars}> is not a valid named block, and named blocks must begin with a lowercase letter`,\n        this.loc\n      );\n    }","sourceCodeStart":914,"sourceCodeEnd":950,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/syntax/lib/v2/normalize.ts#L914-L950","documentation":"A named block element written as self-closing (`<:header />`) is invalid because a named block exists to contain yielded content. The NamedBlockChildren normalizer rejects self-closing named-block syntax at compile time.","triggerScenarios":"Compiling a template containing `<:name/>` (or `<:name />`) as a child of an element/component.","commonSituations":"Auto-formatting or editors converting empty named blocks to self-closing form; developers writing `<:footer />` as shorthand for an empty block.","solutions":["Write the named block with explicit open and close tags: `<:footer></:footer>`.","If the block is intentionally empty, the empty explicit form is still required.","Remove the named block entirely if it is not needed."],"exampleFix":"// before\n<Card><:footer /></Card>\n\n// after\n<Card><:footer></:footer></Card>","handlingStrategy":"validation","validationCode":"// Reject self-closing named blocks.\nfunction assertNamedBlockNotSelfClosing(el) {\n  if (el.tagName.startsWith(':') && el.selfClosing) {\n    throw new Error(`${el.tagName} cannot be self-closing; use <${el.tagName}></${el.tagName}>`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write named blocks with explicit open/close tags, even when empty.","Configure your editor/formatter not to collapse empty elements that start with `:`.","Template-lint for self-closing named blocks."],"tags":["glimmer","template-compiler","named-blocks","syntax-error"],"backgroundTag":"invalid-named-block-usage","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}