hcengineering/platform · error · PlatformError

Adapter for domain ${domain} not found

Error message

Adapter for domain ${domain} not found

What it means

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.

Source

Thrown at server/tool/src/index.ts:466

async function createUpdateIndexes (
  ctx: MeasureContext,
  hierarchy: Hierarchy,
  model: ModelDb,
  pipeline: Pipeline,
  progress: (value: number) => Promise<void>,
  workspaceId: WorkspaceUuid
): Promise<void> {
  const domainHelper = new DomainIndexHelperImpl(ctx, hierarchy, model, workspaceId)
  let completed = 0
  const allDomains = hierarchy.domains()
  for (const domain of allDomains) {
    if (domain === DOMAIN_MODEL || domain === DOMAIN_TRANSIENT || domain === DOMAIN_BENCHMARK) {
      continue
    }
    const adapter = pipeline.context.adapterManager?.getAdapter(domain, false)
    if (adapter === undefined) {
      throw new PlatformError(unknownError(`Adapter for domain ${domain} not found`))
    }
    const dbHelper = adapter.helper?.()

    if (dbHelper !== undefined) {
      await domainHelper.checkDomain(ctx, domain, await dbHelper.estimatedCount(domain), dbHelper)
    }
    completed++
    await progress((100 / allDomains.length) * completed)
  }
}

View on GitHub (pinned to 63e28dc964)

Solutions

  1. Register an adapter for the missing domain before running the upgrade (adapterManager.register... for that domain).
  2. Skip the domain the same way DOMAIN_MODEL/DOMAIN_TRANSIENT/DOMAIN_BENCHMARK are skipped, if it genuinely has no DB storage.
  3. Check for renamed/removed domains and migrate data or clean up the stale domain.

Example fix

// before
const adapter = pipeline.context.adapterManager?.getAdapter(domain, false)
if (adapter === undefined) throw new PlatformError(unknownError(`Adapter for domain ${domain} not found`))
// after
const adapter = pipeline.context.adapterManager?.getAdapter(domain, false)
if (adapter === undefined) continue // skip domains without a DB-backed adapter
Defensive patterns

Strategy: validation

Validate before calling

const missing = allDomains
  .filter(d => d !== DOMAIN_MODEL && d !== DOMAIN_TRANSIENT && d !== DOMAIN_BENCHMARK)
  .filter(d => pipeline.context.adapterManager?.getAdapter(d, false) === undefined)
if (missing.length > 0) throw new Error(`Domains without adapter: ${missing.join(', ')}`)

Type guard

function hasAdapter(mgr: AdapterManager | undefined, domain: Domain): boolean {
  return mgr?.getAdapter(domain, false) !== undefined
}

Try / catch

try {
  await upgradeIndexes(ctx, pipeline)
} catch (err) {
  if ((err as Error).message.startsWith('Adapter for domain')) {
    console.error('Register an adapter for this domain or skip it in upgradeIndexes')
  }
  throw err
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/1439826f02301dfe. Report an issue: GitHub.