emberjs/ember.js · error

${message}

Error message

${message}

What it means

reportSyntaxError is the generic escape hatch in the tokenizer event handlers: any handler that detects invalid template syntax calls it with a custom message, throwing a GlimmerSyntaxError located at the current (collapsed) offset.

Source

Thrown at packages/@glimmer/syntax/lib/parser/tokenizer-event-handlers.ts:561

      Done: () => {
        assert(false, 'This should never be called');
      },
    } as const satisfies {
      [S in keyof States]: Handler;
    };

    let next: string;

    do {
      next = this.tokenizer.peek();
      handlers[state.state](next);
    } while (state.state !== 'Done' && next !== '');

    assert(state.state === 'Done', 'bug in block params parser');
  }

  reportSyntaxError(message: string): void {
    throw generateSyntaxError(message, this.offset().collapsed());
  }

  assembleConcatenatedValue(
    parts: (ASTv1.MustacheStatement | ASTv1.TextNode)[]
  ): ASTv1.ConcatStatement {
    assertPresentArray(parts, `the concatenation parts of an element should not be empty`);

    let first = getFirst(parts);
    let last = getLast(parts);

    return b.concat({
      parts,
      loc: this.source.spanFor(first.loc).extend(this.source.spanFor(last.loc)),
    });
  }

  validateEndTag(
    tag: StartTag | EndTag,

View on GitHub (pinned to 26f97246a8)

Solutions

  1. Read the custom message and the reported line/column
  2. Fix the syntax at the reported location in the .hbs file
  3. Validate templates in CI or in your editor with a Glimmer/Ember language plugin to catch it early
Defensive patterns

Strategy: try-catch

Try / catch

try { parse(template) } catch (e) { if (e.name === 'GlimmerSyntaxError' && e.loc) { report(e.message, e.loc.startPosition, e.loc.endPosition); } else throw e; }

Prevention

When it happens

Trigger: Any invalid Handlebars construct detected by the tokenizer event handlers that has no dedicated error path, e.g. malformed attribute/mustache structures found during parsing.

Common situations: Typos in templates, invalid interpolation forms, editing .hbs files by hand, build tools compiling broken templates.

Related errors


AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01). Data as JSON: /api/errors/515a661243e54c90. Report an issue: GitHub.