{"record":{"id":"5d55cab8dfb5af6a","repo":"emberjs/ember.js","slug":"could-not-create-factory","errorCode":null,"errorMessage":"Could not create factory","messagePattern":"Could not create factory","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@ember/-internals/container/lib/container.ts","lineNumber":420,"sourceCode":"    }\n\n    return instance;\n  }\n\n  // SomeClass { singleton: false, instantiate: true }\n  if (isFactoryInstance(container, fullName, options)) {\n    return factoryManager.create();\n  }\n\n  // SomeClass { singleton: true, instantiate: false } | { instantiate: false } | { singleton: false, instantiation: false }\n  if (\n    isSingletonClass(container, fullName, options) ||\n    isFactoryClass(container, fullName, options)\n  ) {\n    return factoryManager.class;\n  }\n\n  throw new Error('Could not create factory');\n}\n\nfunction destroyDestroyables(container: Container): void {\n  let cache = container.cache;\n  let keys = Object.keys(cache);\n\n  for (let key of keys) {\n    let value = cache[key];\n    assert('has cached value', value);\n\n    if ((value as any).destroy) {\n      (value as any).destroy();\n    }\n  }\n}\n\nfunction resetCache(container: Container) {\n  container.cache = dictionary(null);","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/emberjs/ember.js/blob/26f97246a8bf2e28edf26ac3093da2e86c04ffc5/packages/@ember/-internals/container/lib/container.ts#L402-L438","documentation":"instantiateFactory reached its fall-through with no branch able to produce a value: the fullName resolved to something that is neither a singleton/class factory case the container understands. This usually means an invalid registration state rather than user input.","triggerScenarios":"lookup() on a name whose cached/factory state matches none of the recognized shapes (not a singleton instance, not a singleton class, not a factory class) — typically from an unusual custom RegisterOptions combination or corrupted cache.","commonSituations":"Custom container/registry experimentation; options like { instantiate: false } combined unexpectedly with singleton/factory class registrations; internal misuse from engines or custom resolvers.","solutions":["Use standard registration/lookup patterns (register + lookup with default options)","Check the options passed to lookup/register for stray { instantiate: false }","Verify the fullName is properly registered and normalized","Upgrade ember-source — internal factory handling has changed over versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!owner.hasRegistration(fullName)) throw new Error(`Not registered: ${fullName}`);","typeGuard":"function isRegistrableName(n) { return typeof n === 'string' && n.includes(':'); }","tryCatchPattern":"try { return owner.lookup(fullName, opts); } catch (e) { if (e.message === 'Could not create factory') { /* fix registration/options */ } throw e; }","preventionTips":["Use standard register/lookup with default options","Avoid mixing { instantiate: false } with factory-class paths","Verify fullName validity before lookup","Keep container internals unmodified"],"tags":["ember","container","lookup","factory"],"backgroundTag":"container-factory-resolution-failure","analyzedSha":"26f97246a8bf2e28edf26ac3093da2e86c04ffc5","analyzedAt":"2026-09-01T05:01:28.182Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}