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

  1. Provide accessToken in the config for PAT-based SQL connections
  2. Or provide clientId + clientSecret so the SQL client uses databricks-oauth auth
  3. 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

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


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/87ebd0eab4b4516f. Report an issue: GitHub.