{"record":{"id":"99fcbf9d22fe3a6a","repo":"emberjs/ember.js","slug":"unknown-type-object-type","errorCode":null,"errorMessage":"Unknown type: ${object.type}","messagePattern":"Unknown type: (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/@handlebars/parser/lib/visitor.js","lineNumber":62,"sourceCode":"    for (let i = 0, l = array.length; i < l; i++) {\n      this.acceptKey(array, i);\n\n      if (!array[i]) {\n        array.splice(i, 1);\n        i--;\n        l--;\n      }\n    }\n  },\n\n  accept: function (object) {\n    if (!object) {\n      return;\n    }\n\n    /* istanbul ignore next: Sanity code */\n    if (!this[object.type]) {\n      throw new Exception('Unknown type: ' + object.type, object);\n    }\n\n    if (this.current) {\n      this.parents.unshift(this.current);\n    }\n    this.current = object;\n\n    let ret = this[object.type](object);\n\n    this.current = this.parents.shift();\n\n    if (!this.mutating || ret) {\n      return ret;\n    } else if (ret !== false) {\n      return object;\n    }\n  },\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@handlebars/parser/lib/visitor.js#L44-L80","documentation":"At the top of traversal, the visitor dispatches on object.type; if no handler exists for that type it throws 'Unknown type'. Marked as sanity code — it means an object in the AST (or passed to visit) has a type no visitor method covers.","triggerScenarios":"Visiting an object whose .type is misspelled, undefined, or from a newer AST spec than the visitor supports; passing non-AST objects into visitor.visit.","commonSituations":"Version mismatch between parser and visitor/transform packages; hand-built AST fragments with bad type fields; custom node kinds without registered handlers.","solutions":["Add a handler for the node type on the visitor (this['MyType'] = function(node) {...})","Align package versions so parser and visitor share the same AST spec (ember-source / @glimmer sync)","Log object.type at the failure point to identify the malformed node","Validate or fix hand-constructed nodes' type fields"],"exampleFix":"// before\nvisitor.visit({ type: 'Mustache' })\n// after\nvisitor.visit({ type: 'MustacheStatement' })","handlingStrategy":"validation","validationCode":"function hasHandler(v) { return v != null && typeof v.type === 'string' && typeof visitor[v.type] === 'function'; }\nif (!hasHandler(root)) throw new TypeError('No visitor handler for type: ' + root && root.type);","typeGuard":"function isVisitable(v) { return v != null && typeof v.type === 'string' && typeof Visitor.prototype[v.type] === 'function'; }","tryCatchPattern":"try { visitor.visit(ast); } catch (e) { if (/Unknown type/.test(e.message)) { console.error('Bad node type in AST:', e.message); } throw e; }","preventionTips":["Use exact AST type names ('MustacheStatement', not 'Mustache')","Sync @glimmer/parser and visitor/transform versions","Add a visitor handler when introducing custom node kinds"],"tags":["ast","visitor","handlebars","parser"],"backgroundTag":"unknown-ast-node-type","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}