{"record":{"id":"8dbdfc1e90e9c499","repo":"chroma-core/chroma","slug":"please-install-chromadb-default-embed-as-a-depende","errorCode":null,"errorMessage":"Please install chromadb-default-embed as a dependency with, e.g. `npm install chromadb-default-embed`","messagePattern":"Please install chromadb-default-embed as a dependency with, e\\.g\\. `npm install chromadb-default-embed`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/js/packages/chromadb-core/src/embeddings/DefaultEmbeddingFunction.ts","lineNumber":134,"sourceCode":"          \"Please install the chromadb-default-embed package to use the DefaultEmbeddingFunction, `npm install chromadb-default-embed`\",\n        );\n      }\n      throw _a; // Re-throw other errors\n    }\n    this.transformersApi = TransformersApi;\n  }\n\n  /** @ignore */\n  static async import(): Promise<{\n    // @ts-ignore\n    pipeline: typeof import(\"chromadb-default-embed\");\n  }> {\n    try {\n      // @ts-ignore\n      const { pipeline } = await import(\"chromadb-default-embed\");\n      return { pipeline };\n    } catch (e) {\n      throw new Error(\n        \"Please install chromadb-default-embed as a dependency with, e.g. `npm install chromadb-default-embed`\",\n      );\n    }\n  }\n}\n","sourceCodeStart":116,"sourceCodeEnd":140,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/js/packages/chromadb-core/src/embeddings/DefaultEmbeddingFunction.ts#L116-L140","documentation":"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.","triggerScenarios":"Any rejection of the dynamic import(\"chromadb-default-embed\") reached via DefaultEmbeddingFunction.import(): package absent, partially installed, or unresolvable by the runtime/bundler.","commonSituations":"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.","solutions":["npm install chromadb-default-embed and retry","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","Restore a clean dependency tree: rm -rf node_modules && npm ci","Switch to an explicit embedding function instead of the default"],"exampleFix":"// before: message says 'install', but package.json already lists it\n// after: reproduce the swallowed error to find the real cause\n// $ node -e \"import('chromadb-default-embed').then(m=>console.log('ok'), e=>console.error(e))\"","handlingStrategy":"validation","validationCode":"async function canImport(pkg: string): Promise<boolean> {\n  try {\n    await import(pkg);\n    return true;\n  } catch {\n    return false;\n  }\n}\nif (!(await canImport(\"chromadb-default-embed\"))) {\n  // fail with an actionable message or fall back to another embedding function\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ef.generate(texts);\n} catch (e) {\n  if (e instanceof Error && /install chromadb-default-embed/.test(e.message)) {\n    // probe import('chromadb-default-embed') to distinguish missing vs broken install before advising\n  }\n  throw e;\n}","preventionTips":["Commit the lockfile and install in CI with npm ci so optional deps are reproducible","Add a CI smoke step that imports every optional embedding package you use","Probe optional imports at boot and disable dependent features instead of failing at request time"],"tags":["npm","optional-dependency","module-not-found","error-masking","embeddings"],"backgroundTag":"module-not-found","analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}