{"record":{"id":"5492b47a58a83e54","repo":"emberjs/ember.js","slug":"invalid-path-original","errorCode":null,"errorMessage":"Invalid path: ${original}","messagePattern":"Invalid path: (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/@handlebars/parser/lib/helpers.js","lineNumber":73,"sourceCode":"  }\n\n  let tail = [];\n  let depth = 0;\n\n  for (let i = 0, l = parts.length; i < l; i++) {\n    let part = parts[i].part;\n    // If we have [] syntax then we do not treat path references as operators,\n    // i.e. foo.[this] resolves to approximately context.foo['this']\n    let isLiteral = parts[i].original !== part;\n    let separator = parts[i].separator;\n\n    let partPrefix = separator === '.#' ? '#' : '';\n\n    original += (separator || '') + part;\n\n    if (!isLiteral && (part === '..' || part === '.' || part === 'this')) {\n      if (tail.length > 0) {\n        throw new Exception('Invalid path: ' + original, { loc });\n      } else if (part === '..') {\n        depth++;\n      }\n    } else {\n      tail.push(`${partPrefix}${part}`);\n    }\n  }\n\n  let head = sexpr || tail.shift();\n\n  return {\n    type: 'PathExpression',\n    this: original.startsWith('this.'),\n    data,\n    depth,\n    head,\n    tail,\n    parts: head ? [head, ...tail] : tail,","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@handlebars/parser/lib/helpers.js#L55-L91","documentation":"Handlebars paths may not contain '..', '.', or 'this' as non-final segments; such segments would produce an ambiguous or invalid path. preparePath throws 'Invalid path' with the accumulated original path text when it encounters one of these segments after other segments.","triggerScenarios":"Writing paths like {{foo./bar}}, {{a..b}}, {{this.foo.this}}, or a path where '..' / '.' / 'this' appears mid-path (tail.length > 0) rather than as the whole path.","commonSituations":"Attempting relative-path navigation from Ember templates (not supported); typos like {{item..name}}; migrating templates from other templating languages that allow parent traversal.","solutions":["Remove '..'/'.'/ 'this' from the middle of the path; bind the needed context explicitly","Use {{this.foo}} only as the whole leading segment, not nested: this.foo.bar is fine, foo.this is not","Compute derived values in JS (getter/component property) instead of complex paths","Split the expression: pass the object as a block param and access simple properties on it"],"exampleFix":"// before\n{{article..title}}\n// after\n{{#let this.article as |article|}}\n  {{article.title}}\n{{/let}}","handlingStrategy":"validation","validationCode":"if (/\\.{1,2}|\\bthis\\b/.test(path.replace(/^(this\\.)|(\\.|\\.\\.)/, ''))) throw new Error('Invalid mid-path segment: ' + path);","typeGuard":null,"tryCatchPattern":"try { parse(src); } catch (e) { if (/Invalid path/.test(e.message)) { console.error('Fix path near', e.loc || 'unknown'); } throw e; }","preventionTips":["Avoid '..' parent navigation — bind contexts with block params instead","Use {{this.foo}} only as a leading segment","Precompute complex lookups in JS getters"],"tags":["template","handlebars","parser","syntax","path"],"backgroundTag":"invalid-path-template","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}