emberjs/ember.js · error · Error
Cannot call `setComponentTemplate` multiple times on the sam
Error message
Cannot call `setComponentTemplate` multiple times on the same class (`${debugToString!(obj)}`) What it means
Error "Cannot call `setComponentTemplate` multiple times on the same class (`${debugToString!(obj)}`)" thrown in emberjs/ember.js.
Source
Thrown at packages/@glimmer/manager/lib/public/template.ts:16
import { DEBUG } from '@glimmer/env';
import type { TemplateFactory } from '@glimmer/interfaces';
import debugToString from '@glimmer/debug-util/lib/debug-to-string';
const TEMPLATES: WeakMap<object, TemplateFactory> = new WeakMap();
const getPrototypeOf = Reflect.getPrototypeOf;
export function setComponentTemplate(factory: TemplateFactory, obj: object) {
if (DEBUG && !(obj !== null && (typeof obj === 'object' || typeof obj === 'function'))) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
throw new Error(`Cannot call \`setComponentTemplate\` on \`${debugToString!(obj)}\``);
}
if (DEBUG && TEMPLATES.has(obj)) {
throw new Error(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- @fixme
`Cannot call \`setComponentTemplate\` multiple times on the same class (\`${debugToString!(
obj
)}\`)`
);
}
TEMPLATES.set(obj, factory);
return obj;
}
export function getComponentTemplate(obj: object): TemplateFactory | undefined {
let pointer: object | null = obj;
while (pointer !== null) {
let template = TEMPLATES.get(pointer);
View on GitHub (pinned to 26f97246a8)
When it happens
Trigger: Thrown at packages/@glimmer/manager/lib/public/template.ts:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of emberjs/ember.js@26f97246a8 (2026-09-01).
Data as JSON: /api/errors/7ff51deaf6e1022d.
Report an issue: GitHub.