mem0ai/mem0 · error · Error

Databricks vector store requires accessToken or clientId/cli

Error message

Databricks vector store requires accessToken or clientId/clientSecret when httpClient is not provided.

What it means

createHttpClient() builds the axios client for the Databricks Vector Search API. Without a user-supplied httpClient it needs credentials: an accessToken for PAT auth, or clientId/clientSecret for OAuth (service principal) auth. If none are present there is no way to authenticate, so it throws.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/databricks.ts:895

      ALTER TABLE ${this.fullTableName}
      SET TBLPROPERTIES ('delta.enableChangeDataFeed' = 'true')
    `);
  }

  private createHttpClient(): AxiosInstance {
    const baseURL = `${this.workspaceUrl}/api/2.0/vector-search`;

    if (this.accessToken) {
      return axios.create({
        baseURL,
        headers: {
          Authorization: `Bearer ${this.accessToken}`,
        },
      });
    }

    if (!this.clientId || !this.clientSecret) {
      throw new Error(
        "Databricks vector store requires accessToken or clientId/clientSecret when httpClient is not provided.",
      );
    }

    const baseClient = axios.create({ baseURL });
    return {
      get: async (url: string, config?: Record<string, any>) =>
        baseClient.get(url, await this.withOAuthHeaders("GET", url, config)),
      post: async (url: string, data?: any, config?: Record<string, any>) =>
        baseClient.post(
          url,
          data,
          await this.withOAuthHeaders("POST", url, config),
        ),
      delete: async (url: string, config?: Record<string, any>) =>
        baseClient.delete(
          url,
          await this.withOAuthHeaders("DELETE", url, config),

View on GitHub (pinned to 001c235229)

Solutions

  1. Add accessToken: '<personal-access-token>' (or DATABRICKS_TOKEN) to the config
  2. Or provide both clientId and clientSecret for a service principal (M2M OAuth)
  3. For tests or custom transport, inject an httpClient matching the expected get/post interface

Example fix

// before
new Databricks({ host, catalog: 'main', schema: 'default' });

// after
new Databricks({ host, accessToken: process.env.DATABRICKS_TOKEN!, catalog: 'main', schema: 'default' });
Defensive patterns

Strategy: validation

Validate before calling

if (!cfg.httpClient && !cfg.accessToken && !(cfg.clientId && cfg.clientSecret)) {
  throw new Error('Databricks config requires accessToken, clientId/clientSecret, or httpClient');
}

Type guard

const hasDatabricksAuth = (c: any): boolean =>
  Boolean(c?.httpClient) || Boolean(c?.accessToken) || Boolean(c?.clientId && c?.clientSecret);

Prevention

When it happens

Trigger: Constructing the store with only host/catalog/schema but no accessToken and no clientId+clientSecret, and no custom httpClient — typically because DATABRICKS_TOKEN was unset in the environment the config was built from.

Common situations: Secrets present locally but missing in CI/deployment; using clientSecret with a missing clientId (both are required together); expecting the store to pick up ambient Databricks CLI auth, which it does not.

Related errors


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