emberjs/ember.js · error

${state.message}

Error message

${state.message}

What it means

While parsing a possible block params list, the parser entered the Error state with a message; if the next character terminates the tag (space, `/`, `>`, or EOF), the accumulated error is thrown with a span covering the bad token. This surfaces whatever specific failure occurred while scanning the `|...|` region (e.g. malformed param names).

Source

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

          // Don't consume, let the normal tokenizer code handle the next steps
          state = { state: 'Done' };
        } else {
          // Slurp up the next "token" for the error span
          state = {
            state: 'Error',
            message:
              'Invalid block parameters syntax: expecting the tag to be closed with ">" or "/>" after parameters list',
            start: this.offset(),
          };
          this.tokenizer.consume();
        }
      },

      Error: (next: string) => {
        assert(state.state === 'Error', 'bug in block params parser');

        if (next === '' || next === '/' || next === '>' || isSpace(next)) {
          throw generateSyntaxError(state.message, state.start.until(this.offset()));
        } else {
          // Slurp up the next "token" for the error span
          this.tokenizer.consume();
        }
      },

      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);

View on GitHub (pinned to 26f97246a8)

Solutions

  1. Read the interpolated state.message for the specific parse problem
  2. Fix the token(s) inside the `| ... |` region indicated by the error span
  3. Remove the pipes if you didn't intend block params

Example fix

// before
<div |a b!|>...</div>
// after
<div |a b|>...</div>
Defensive patterns

Strategy: try-catch

Validate before calling

// validate block params region contains only identifier-ish tokens
const params = template.match(/\|([^|]*)\|/);
if (params && !/^[\s$\w]+$/.test(params[1])) {
  throw new Error('Invalid token inside block params list: ' + params[1]);
}

Try / catch

try { parse(template) } catch (e) { /* e.message carries the interpolated state.message; log with template loc */ }

Prevention

When it happens

Trigger: Calling appendToAttributeName / tag parsing when the text after `|` in a would-be block params list is invalid and immediately followed by a tag-terminating character, e.g. `<div |a b|>` where the list itself failed to parse.

Common situations: Malformed block params like `|a-b!|`, stray `|` characters in attribute areas, hand-edited templates with typos inside the pipes.

Related errors


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