mem0ai/mem0 · error · Error

Databricks OAuth token response did not include access_token

Error message

Databricks OAuth token response did not include access_token.

What it means

After a successful HTTP round-trip to the Databricks OAuth token endpoint, the response body must contain a non-empty string access_token. If the field is missing, not a string, or empty, the store refuses to cache or use it and throws.

Source

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

    }

    const response = await axios.post(
      `${this.workspaceUrl}/oidc/v1/token`,
      formData,
      {
        auth: {
          username: this.clientId,
          password: this.clientSecret,
        },
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      },
    );

    const token = response?.data?.access_token;
    if (typeof token !== "string" || token.length === 0) {
      throw new Error(
        "Databricks OAuth token response did not include access_token.",
      );
    }

    const expiresInSeconds = Number(response?.data?.expires_in ?? 3600);
    this.oauthTokens.set(cacheKey, {
      accessToken: token,
      expiresAt: Date.now() + Math.max(1, expiresInSeconds) * 1000,
    });
    return token;
  }

  private async getSession(): Promise<DatabricksSqlSessionLike> {
    if (this.session) {
      return this.session;
    }

    if (!this._sessionPromise) {

View on GitHub (pinned to 001c235229)

Solutions

  1. Verify clientId/clientSecret are correct service-principal credentials with access to the workspace
  2. Check network path for proxies rewriting the response; capture response.data to inspect what actually came back
  3. If the environment blocks OAuth, fall back to a personal access token via accessToken
Defensive patterns

Strategy: try-catch

Try / catch

try { await store.search(q, 5); } catch (e) { if (e instanceof Error && e.message.includes('access_token')) { logTokenEndpointDiagnostics(); // inspect proxy/network path, verify SP credentials } throw e; }

Prevention

When it happens

Trigger: clientId/clientSecret are accepted by the proxy/network layer but the endpoint returns an unexpected body — e.g. an HTML error page from a corporate proxy, a 200 response with an error payload, or an API change in the token response shape.

Common situations: Corporate proxies or middleboxes intercepting the token request; a misconfigured auth URL; Databricks returning an error envelope with 200; clientId/secret valid enough to avoid a 4xx but scoped incorrectly.

Related errors


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