emberjs/ember.js · error

Attempted to parse a path expression, but it was not valid.

Error message

Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z.

What it means

For data paths (paths starting with @, i.e. @arg references to named arguments), the parser shifts the head segment off the path parts; if there is no head segment the @arg path is malformed, so the parser throws. A valid @path must start with a lowercase letter a-z after the @ (e.g. @name, @items).

Source

Thrown at packages/@glimmer/syntax/lib/parser/handlebars-node-visitors.ts:454

    // named literally "bar.baz" on `this.foo`). By convention, we use `null`
    // for this purpose.
    if (/^this(?:\..+)?$/u.test(original)) {
      thisHead = true;
    }

    let pathHead: ASTv1.PathHead;
    if (thisHead) {
      pathHead = b.this({
        loc: this.source.spanFor({
          start: path.loc.start,
          end: { line: path.loc.start.line, column: path.loc.start.column + 4 },
        }),
      });
    } else if (path.data) {
      const head = parts.shift();

      if (head === undefined) {
        throw generateSyntaxError(
          `Attempted to parse a path expression, but it was not valid. Paths beginning with @ must start with a-z.`,
          this.source.spanFor(path.loc)
        );
      }

      pathHead = b.atName({
        name: `@${head}`,
        loc: this.source.spanFor({
          start: path.loc.start,
          end: { line: path.loc.start.line, column: path.loc.start.column + head.length + 1 },
        }),
      });
    } else {
      const head = parts.shift();

      if (head === undefined) {
        throw generateSyntaxError(
          `Attempted to parse a path expression, but it was not valid. Paths must start with a-z or A-Z.`,

View on GitHub (pinned to 26f97246a8)

Solutions

  1. Give the @arg a valid lowercase name: {{@}} → {{@value}} or whatever the declared argument is.
  2. Verify the component actually declares/uses that argument and that the name after @ starts with a-z (no digits or uppercase, e.g. @items not @Items).
  3. Check for a stray character after @ (like {{@.x}}) and write the full path, e.g. {{@user.name}}.

Example fix

// before
<Greeting @ />

// after
<Greeting @name="world" />
Defensive patterns

Strategy: validation

Validate before calling

// validate @arg references before compiling
function assertValidAtArgs(template) {
  const bad = template.match(/@\s*[^a-z][\w.]*/g);
  if (bad) throw new Error(`Invalid @arg reference(s): ${bad.join(', ')}; must start with a-z`);
}
assertValidAtArgs(template);

Prevention

When it happens

Trigger: Compiling a template with a PathExpression marked data=true whose parts array is empty after validation — e.g. a bare or malformed @arg reference like {{@}} or {{@.x}} reaching the parser. Thrown when path.data is true and parts.shift() returns undefined.

Common situations: Typos such as {{@}} or an editor autocompleting an @arg before the name is typed; code generators emitting '@' placeholders; copy/paste from languages where @ has other meanings (CSS @rules, decorators).

Related errors


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