chroma-core/chroma · error · Error

Please install chromadb-default-embed as a dependency with,

Error message

Please install chromadb-default-embed as a dependency with, e.g. `npm install chromadb-default-embed`

What it means

Companion static helper behind error 40: it wraps import("chromadb-default-embed") in an unconditional try/catch, so ANY import failure — not just a missing package — is replaced with this install message. A corrupted install, an exports-map incompatibility, or a bundler resolution error all masquerade as 'not installed', which makes diagnosis harder than the loadClient path.

Source

Thrown at clients/js/packages/chromadb-core/src/embeddings/DefaultEmbeddingFunction.ts:134

          "Please install the chromadb-default-embed package to use the DefaultEmbeddingFunction, `npm install chromadb-default-embed`",
        );
      }
      throw _a; // Re-throw other errors
    }
    this.transformersApi = TransformersApi;
  }

  /** @ignore */
  static async import(): Promise<{
    // @ts-ignore
    pipeline: typeof import("chromadb-default-embed");
  }> {
    try {
      // @ts-ignore
      const { pipeline } = await import("chromadb-default-embed");
      return { pipeline };
    } catch (e) {
      throw new Error(
        "Please install chromadb-default-embed as a dependency with, e.g. `npm install chromadb-default-embed`",
      );
    }
  }
}

View on GitHub (pinned to aecdd12c8a)

Solutions

  1. npm install chromadb-default-embed and retry
  2. If already installed, reproduce the import directly (node -e "import('chromadb-default-embed').then(console.log,console.error)") to expose the real error this catch swallows
  3. Restore a clean dependency tree: rm -rf node_modules && npm ci
  4. Switch to an explicit embedding function instead of the default

Example fix

// before: message says 'install', but package.json already lists it
// after: reproduce the swallowed error to find the real cause
// $ node -e "import('chromadb-default-embed').then(m=>console.log('ok'), e=>console.error(e))"
Defensive patterns

Strategy: validation

Validate before calling

async function canImport(pkg: string): Promise<boolean> {
  try {
    await import(pkg);
    return true;
  } catch {
    return false;
  }
}
if (!(await canImport("chromadb-default-embed"))) {
  // fail with an actionable message or fall back to another embedding function
}

Try / catch

try {
  await ef.generate(texts);
} catch (e) {
  if (e instanceof Error && /install chromadb-default-embed/.test(e.message)) {
    // probe import('chromadb-default-embed') to distinguish missing vs broken install before advising
  }
  throw e;
}

Prevention

When it happens

Trigger: Any rejection of the dynamic import("chromadb-default-embed") reached via DefaultEmbeddingFunction.import(): package absent, partially installed, or unresolvable by the runtime/bundler.

Common situations: package.json lists the package but node_modules is out of sync (fix with npm ci); bundlers failing on the package's exports map; optionalDependencies stripped in minimal CI/Docker installs; ESM/CJS interop edge cases in transpiled setups.

Related errors


AI-assisted analysis of chroma-core/chroma@aecdd12c8a (2026-08-16). Data as JSON: /api/errors/8dbdfc1e90e9c499. Report an issue: GitHub.