{"record":{"id":"7a8e0252a0b34a7d","repo":"emberjs/ember.js","slug":"invalid-block-parameters-syntax-invalid-identifie","errorCode":null,"errorMessage":"Invalid block parameters syntax: invalid identifier name \\`${state.name}\\`","messagePattern":"Invalid block parameters syntax: invalid identifier name \\\\`(.+?)\\\\`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts","lineNumber":471,"sourceCode":"          this.pendingError = {\n            mustache(loc: src.SourceSpan) {\n              throw generateSyntaxError(\n                `Invalid block parameters syntax: mustaches cannot be used inside parameters list`,\n                loc\n              );\n            },\n            eof(loc: src.SourceOffset) {\n              throw generateSyntaxError(\n                `Invalid block parameters syntax: expecting the tag to be closed with \">\" or \"/>\" after parameters list`,\n                as.start.until(loc)\n              );\n            },\n          };\n        } else if (next === '|' || isSpace(next)) {\n          let loc = state.start.until(this.offset());\n\n          if (state.name === 'this' || ID_INVERSE_PATTERN.test(state.name)) {\n            throw generateSyntaxError(\n              `Invalid block parameters syntax: invalid identifier name \\`${state.name}\\``,\n              loc\n            );\n          }\n\n          element.params.push(b.var({ name: state.name, loc }));\n\n          state = next === '|' ? { state: 'AfterEndPipe' } : { state: 'BeforeBlockParamName' };\n          this.tokenizer.consume();\n        } else if (next === '>' || next === '/') {\n          throw generateSyntaxError(\n            `Invalid block parameters syntax: expecting \"|\" but the tag was closed prematurely`,\n            as.start.until(this.offset().move(1))\n          );\n        } else {\n          // slurp up anything else into the name, validate later\n          state.name += next;\n          this.tokenizer.consume();","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts#L453-L489","documentation":"A collected block param identifier is invalid: it is either `this` (which cannot be a block param name) or matches characters not allowed in Handlebars identifiers (checked via ID_INVERSE_PATTERN). The parser validates each identifier when it hits a pipe or space that terminates it.","triggerScenarios":"parsePossibleBlockParams (via appendToAttributeName) when a param name is terminated by `|` or whitespace and state.name === 'this' or ID_INVERSE_PATTERN.test(state.name) passes — e.g. `<Foo as |this|>`, `<Foo as |a-b!|>`.","commonSituations":"Trying to shadow `this`; using dashes-plus-invalid characters, unicode, or punctuation in param names; typos like `as |my param!|`.","solutions":["Rename the param to a valid Handlebars identifier (letters, digits, underscore, non-leading dash per handlebars ID rules)","Never use `this` as a block param name; pick a distinct name"],"exampleFix":"// before\n<Foo as |this|>{{this}}</Foo>\n// after\n<Foo as |value|>{{value}}</Foo>","handlingStrategy":"validation","validationCode":"// Validate each block param name against Handlebars ID rules\nconst ID_INVERSE = /[!\"#%&'()*+,./;<=>@[\\]^`{|}~]/;\nfor (const m of template.matchAll(/as\\s+\\|([^|]*)\\|/g)) {\n  for (const name of m[1].trim().split(/\\s+/)) {\n    if (name === 'this' || ID_INVERSE.test(name)) {\n      throw new Error(`Invalid block param name: ${name}`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use `this` as a block param name","Stick to simple identifiers (letters, digits, underscore) for params"],"tags":["glimmer","handlebars","template-syntax","block-params","identifier"],"backgroundTag":"invalid-block-params-syntax","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}