{"record":{"id":"1439826f02301dfe","repo":"hcengineering/platform","slug":"adapter-for-domain-domain-not-found","errorCode":null,"errorMessage":"Adapter for domain ${domain} not found","messagePattern":"Adapter for domain (.+?) not found","errorType":"exception","errorClass":"PlatformError","httpStatus":null,"severity":"error","filePath":"server/tool/src/index.ts","lineNumber":466,"sourceCode":"\nasync function createUpdateIndexes (\n  ctx: MeasureContext,\n  hierarchy: Hierarchy,\n  model: ModelDb,\n  pipeline: Pipeline,\n  progress: (value: number) => Promise<void>,\n  workspaceId: WorkspaceUuid\n): Promise<void> {\n  const domainHelper = new DomainIndexHelperImpl(ctx, hierarchy, model, workspaceId)\n  let completed = 0\n  const allDomains = hierarchy.domains()\n  for (const domain of allDomains) {\n    if (domain === DOMAIN_MODEL || domain === DOMAIN_TRANSIENT || domain === DOMAIN_BENCHMARK) {\n      continue\n    }\n    const adapter = pipeline.context.adapterManager?.getAdapter(domain, false)\n    if (adapter === undefined) {\n      throw new PlatformError(unknownError(`Adapter for domain ${domain} not found`))\n    }\n    const dbHelper = adapter.helper?.()\n\n    if (dbHelper !== undefined) {\n      await domainHelper.checkDomain(ctx, domain, await dbHelper.estimatedCount(domain), dbHelper)\n    }\n    completed++\n    await progress((100 / allDomains.length) * completed)\n  }\n}\n","sourceCodeStart":448,"sourceCodeEnd":477,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/server/tool/src/index.ts#L448-L477","documentation":"During index upgrade/creation the tool iterates every known domain and requires a registered storage adapter for each one. If adapterManager.getAdapter(domain, false) returns undefined the tool cannot create indexes or estimate document counts for that domain, so it aborts with this PlatformError. This indicates a missing/misconfigured adapter mapping for a domain present in the model or hierarchy.","triggerScenarios":"Running upgradeIndexes/createUpdateIndexes when a domain exists in the list of all domains but no adapter was registered for it in the pipeline's adapterManager (e.g. a custom or removed domain, or adapters not registered before running the tool).","commonSituations":"Custom domains added without registering a matching adapter; adapter registration skipped or partially completed during workspace tool startup; domains renamed between versions leaving stale entries; running upgrade tooling before full pipeline initialization.","solutions":["Register an adapter for the missing domain before running the upgrade (adapterManager.register... for that domain).","Skip the domain the same way DOMAIN_MODEL/DOMAIN_TRANSIENT/DOMAIN_BENCHMARK are skipped, if it genuinely has no DB storage.","Check for renamed/removed domains and migrate data or clean up the stale domain."],"exampleFix":"// before\nconst adapter = pipeline.context.adapterManager?.getAdapter(domain, false)\nif (adapter === undefined) throw new PlatformError(unknownError(`Adapter for domain ${domain} not found`))\n// after\nconst adapter = pipeline.context.adapterManager?.getAdapter(domain, false)\nif (adapter === undefined) continue // skip domains without a DB-backed adapter","handlingStrategy":"validation","validationCode":"const missing = allDomains\n  .filter(d => d !== DOMAIN_MODEL && d !== DOMAIN_TRANSIENT && d !== DOMAIN_BENCHMARK)\n  .filter(d => pipeline.context.adapterManager?.getAdapter(d, false) === undefined)\nif (missing.length > 0) throw new Error(`Domains without adapter: ${missing.join(', ')}`)","typeGuard":"function hasAdapter(mgr: AdapterManager | undefined, domain: Domain): boolean {\n  return mgr?.getAdapter(domain, false) !== undefined\n}","tryCatchPattern":"try {\n  await upgradeIndexes(ctx, pipeline)\n} catch (err) {\n  if ((err as Error).message.startsWith('Adapter for domain')) {\n    console.error('Register an adapter for this domain or skip it in upgradeIndexes')\n  }\n  throw err\n}","preventionTips":["Register an adapter for every custom domain at pipeline setup.","Skip non-DB domains (like DOMAIN_MODEL, blob domains) in indexing/upgrade loops.","Run adapter registration before any upgrade/index tooling.","Audit for stale domains after renaming/removing domains between versions."],"tags":["adapter","domain","indexing","configuration"],"backgroundTag":"missing-adapter-for-domain","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}