mem0ai/mem0 · error · Error

Databricks vector store requires either workspaceUrl or host

Error message

Databricks vector store requires either workspaceUrl or host.

What it means

extractHostAndWorkspaceUrl() derives the workspace URL used for every Management/Vector Search API call. It first tries config.workspaceUrl, then config.host, and throws if neither is set — the store has no endpoint to talk to.

Source

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

  host: string;
  workspaceUrl: string;
} {
  if (config.workspaceUrl) {
    const url = new URL(config.workspaceUrl);
    return {
      host: url.host,
      workspaceUrl: `${url.protocol}//${url.host}`,
    };
  }

  if (config.host) {
    return {
      host: config.host,
      workspaceUrl: `https://${config.host}`,
    };
  }

  throw new Error(
    "Databricks vector store requires either workspaceUrl or host.",
  );
}

// `Memory.search()` hands keywordSearch() an already-lemmatized query, so BM25 has to score
// against lemmatized text. Same contract as baidu.ts / pgvector.ts.
function lemmatizedText(payload: Record<string, any>): string {
  const data = typeof payload.data === "string" ? payload.data : "";
  return typeof payload.textLemmatized === "string" &&
    payload.textLemmatized.length > 0
    ? payload.textLemmatized
    : data;
}

function formatSqlValue(value: any): string {
  if (value === null || value === undefined) {
    return "NULL";
  }

View on GitHub (pinned to 001c235229)

Solutions

  1. Set host: 'adb-1234567890123456.7.azuredatabricks.net' (or your cloud's equivalent) in the vector store config
  2. Or set workspaceUrl: 'https://adb-....azuredatabricks.net' — both forms are accepted
  3. If config comes from env, ensure the variable is present and fail config loading early when it is missing

Example fix

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

// after
new Databricks({
  host: 'adb-1234567890123456.7.azuredatabricks.net',
  accessToken,
  catalog: 'main',
  schema: 'default',
});
Defensive patterns

Strategy: validation

Validate before calling

if (!cfg.workspaceUrl && !cfg.host) {
  throw new Error('Databricks config requires workspaceUrl or host');
}

Type guard

const hasDatabricksHost = (c: any): boolean => Boolean(c?.workspaceUrl || c?.host);

Prevention

When it happens

Trigger: Constructing the Databricks vector store with neither workspaceUrl nor host in the config, e.g. both left undefined because the env vars were not read (DATABRICKS_HOST unset).

Common situations: Missing DATABRICKS_HOST / DATABRICKS_URL in the deployment environment; passing the host inside an auth sub-object or wrong key ('serverUrl', 'workspace'); config built from a partial env where the key is optional and skipped.

Related errors


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