mem0ai/mem0 · error · Error
The '@databricks/sql' package is required to use the Databri
Error message
The '@databricks/sql' package is required to use the Databricks vector store. Install it with: npm install @databricks/sql (original error: ${detail}) What it means
The store lazily imports @databricks/sql for SQL warehouse connections. If the package is not installed (it is an optional peer dependency), the dynamic import rejects; the store wraps that with install instructions and the original error, and clears the cached promise so a later call can retry after installing.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/databricks.ts:1059
* on the first SQL call instead, the way milvus.ts and baidu.ts load theirs.
*
* This MUST be a dynamic `import()`, never `require()`: tsup/esbuild rewrite `require()` in
* the published ESM bundle (`dist/oss/index.mjs`) into a `__require` shim that throws
* `Dynamic require of "..." is not supported`, so every ESM consumer would hit a dead
* provider even with the driver installed.
*/
private async getSqlModule(): Promise<{
DBSQLClient: new () => DatabricksSqlClientLike;
}> {
if (!this.sqlModulePromise) {
this.sqlModulePromise = import("@databricks/sql").then(
(mod) =>
mod as unknown as { DBSQLClient: new () => DatabricksSqlClientLike },
(err) => {
// Let a later call retry rather than caching the rejection forever.
this.sqlModulePromise = undefined;
const detail = err instanceof Error ? err.message : String(err);
throw new Error(
"The '@databricks/sql' package is required to use the Databricks vector store. " +
`Install it with: npm install @databricks/sql (original error: ${detail})`,
);
},
);
}
return this.sqlModulePromise;
}
private async getSqlClient(): Promise<DatabricksSqlClientLike> {
if (!this.sqlClient) {
const { DBSQLClient } = await this.getSqlModule();
this.sqlClient = new DBSQLClient();
}
return this.sqlClient;
}
private async openSession(): Promise<DatabricksSqlSessionLike> {View on GitHub (pinned to 001c235229)
Solutions
- Install it: npm install @databricks/sql (or pnpm add @databricks/sql)
- After installing, the retry works without code changes — the failed import is not cached
- In Docker/CI builds, ensure the install step includes optional peer dependencies
Example fix
# before npm install mem0ai # after npm install mem0ai @databricks/sql
Defensive patterns
Strategy: try-catch
Validate before calling
async function hasDatabricksSql(): Promise<boolean> {
try { await import('@databricks/sql'); return true; } catch { return false; }
} Try / catch
try { await store.list(); } catch (e) { if (e instanceof Error && e.message.includes("'@databricks/sql'")) { await exec('npm install @databricks/sql'); /* retry once */ } throw e; } Prevention
- Add @databricks/sql to package.json alongside mem0ai when using the Databricks store
- Run a smoke test (list() once) at deployment start to surface missing optional deps early
When it happens
Trigger: Using the Databricks vector store without @databricks/sql in package.json — the first operation needing a SQL session (createTable, insert, list, etc.) triggers getSqlModule() and throws.
Common situations: Fresh clone after the dependency was moved to optional peerDeps; using a package manager that skipped optional peers; bundlers that tree-shake or fail to resolve the dynamic import.
Related errors
- The '@aws-sdk/client-bedrock-runtime' package is required to
- The '${pkg}' package is required to use the ${label}. Instal
- Invalid ${label} '${name}': only letters, digits, and unders
- Databricks vector store requires either workspaceUrl or host
- Databricks vector store only accepts finite numbers.
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/e418336ca478d715.
Report an issue: GitHub.