{"record":{"id":"f0ec116bfcae8742","repo":"mastra-ai/mastra","slug":"factory-storage-domain-name-is-not-registered","errorCode":null,"errorMessage":"Factory storage domain '${name}' is not registered","messagePattern":"Factory storage domain '(.+?)' is not registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/factory-storage.ts","lineNumber":302,"sourceCode":"    await Promise.all([...this.#domains.keys()].map(name => this.#initDomain(name).catch(() => undefined)));\n  }\n\n  /** Backend-specific connection initialization. */\n  protected abstract initStorage(): Promise<void>;\n\n  registerDomain<T extends FactoryStorageDomain>(domain: T): T {\n    if (this.#domains.has(domain.name)) {\n      throw new Error(`Factory storage domain '${domain.name}' is already registered`);\n    }\n    domain.__bindFactoryStorage(this);\n    this.#domains.set(domain.name, domain);\n    return domain;\n  }\n\n  getDomain<T extends FactoryStorageDomain = FactoryStorageDomain>(name: string): T {\n    const domain = this.#domains.get(name);\n    if (!domain) {\n      throw new Error(`Factory storage domain '${name}' is not registered`);\n    }\n    return domain as T;\n  }\n\n  hasDomain(name: string): boolean {\n    return this.#domains.has(name);\n  }\n\n  domainNames(): string[] {\n    return [...this.#domains.keys()];\n  }\n\n  isDomainReady(name: string): boolean {\n    return this.#readyDomains.has(name);\n  }\n\n  domainInitError(name: string): unknown {\n    return this.#domainErrors.get(name);","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/factory-storage.ts#L284-L320","documentation":"getDomain() looks a domain up by name in the storage's registered-domain map and throws when no domain with that name exists. This is a fast-fail so callers get a clear error instead of an undefined domain causing a TypeError later.","triggerScenarios":"Calling `storage.getDomain('someName')` (directly or via ensureDomainReady/domain helpers) where 'someName' was never registered on this storage instance, or with a typo/mismatched domain name.","commonSituations":"Typo in the domain name string; querying a domain on a different storage instance than the one where it was registered; calling before initStorage() ran; version changes where a domain was renamed.","solutions":["Use `storage.hasDomain(name)` to check before getDomain, or use the typed accessor (e.g. `storage.memorySettings`) instead of string lookup.","Verify the exact domain name registered by your storage backend's initStorage().","Ensure the owning storage has been initialized before lookups.","Confirm you are calling on the same storage instance where the domain was registered."],"exampleFix":"// before\nconst d = storage.getDomain('memory-setting'); // typo: throws\n\n// after\nif (storage.hasDomain('memorySettings')) {\n  const d = storage.getDomain('memorySettings');\n}","handlingStrategy":"validation","validationCode":"const DOMAIN_NAMES = ['intake','audit','workItems','modelCredentials','modelPacks','memorySettings'];\nfunction domainExists(storage, name) {\n  return storage.hasDomain(name);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const d = storage.getDomain(name);\n} catch (e) {\n  if (e.message.includes('is not registered')) {\n    throw new Error(`Domain \"${name}\" missing; did storage.init() run and is the name spelled correctly?`);\n  }\n  throw e;\n}","preventionTips":["Prefer typed accessors over string-based getDomain where available.","Keep domain name strings in a shared constant module to avoid typos.","Verify the storage backend actually registers the domain you request.","Log the list of registered names (via hasDomain checks) when debugging lookups."],"tags":["storage","initialization","lookup"],"backgroundTag":"dependency-not-initialized","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}