mem0ai/mem0 · error · Error
Databricks vector store requires accessToken or clientId/cli
Error message
Databricks vector store requires accessToken or clientId/clientSecret for SQL connections.
What it means
buildSqlConfig() prepares connection options for DBSQLClient. It prefers OAuth (authType 'databricks-oauth') when clientId+clientSecret are set; otherwise it requires a token for PAT auth. With neither credential present it cannot open a SQL connection and throws.
Source
Thrown at mem0-ts/src/oss/src/vector_stores/databricks.ts:1099
}
private buildSqlConnectionOptions(): Record<string, any> {
const base = {
host: this.host,
path: this.httpPath,
} as Record<string, any>;
if (this.clientId && this.clientSecret) {
return {
...base,
authType: "databricks-oauth",
oauthClientId: this.clientId,
oauthClientSecret: this.clientSecret,
};
}
if (!this.accessToken) {
throw new Error(
"Databricks vector store requires accessToken or clientId/clientSecret for SQL connections.",
);
}
return {
...base,
token: this.accessToken,
};
}
/**
* Drop the cached session/session-promise so the next `getSession()` opens a fresh one.
* Called after any SQL failure below -- a stale session (expired token, dropped socket)
* would otherwise keep being handed out and keep failing forever.
*/
private resetSession(): void {
this.session = undefined;
this._sessionPromise = undefined;View on GitHub (pinned to 001c235229)
Solutions
- Provide accessToken in the config for PAT-based SQL connections
- Or provide clientId + clientSecret so the SQL client uses databricks-oauth auth
- Remember a custom httpClient only covers REST API calls — SQL warehouse connections always need credentials
Example fix
// before
new Databricks({ host, httpClient: myClient }); // SQL ops later fail
// after
new Databricks({ host, httpClient: myClient, accessToken: process.env.DATABRICKS_TOKEN! }); Defensive patterns
Strategy: validation
Validate before calling
if (!(cfg.clientId && cfg.clientSecret) && !cfg.accessToken) {
throw new Error('SQL connections need accessToken or clientId/clientSecret — httpClient only covers REST');
} Prevention
- Remember a custom httpClient does not authenticate SQL sessions — always set real credentials
- Include SQL credentials in config checklists, not just API auth
When it happens
Trigger: Store configured with httpClient-only auth (API calls work via the injected client) but no accessToken and no clientId/clientSecret — the first SQL operation (createTable/insert/list) then fails here.
Common situations: Split auth: custom httpClient for the REST API while SQL connections still need real credentials; env var for the token named differently than the config reads; disabling PAT auth on the workspace expecting only the httpClient to be used.
Related errors
- Databricks vector store requires accessToken or clientId/cli
- Databricks vector store requires clientId/clientSecret for O
- Either access_token or both client_id/client_secret or azure
- Invalid ${label} '${name}': only letters, digits, and unders
- Databricks vector store requires either workspaceUrl or host
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/87ebd0eab4b4516f.
Report an issue: GitHub.