mem0ai/mem0 · error · Error

Databricks storage-optimized endpoints require dimensions di

Error message

Databricks storage-optimized endpoints require dimensions divisible by 16.

What it means

Databricks storage-optimized vector indices internally quantize embeddings and require the vector dimension to be a multiple of 16. The constructor checks dimension % 16 and throws at creation time when it is not.

Source

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

      config.syncPollIntervalMs ?? DEFAULT_SYNC_POLL_INTERVAL_MS;
    this.syncTimeoutMs = config.syncTimeoutMs ?? DEFAULT_SYNC_TIMEOUT_MS;
    this.sqlClient = config.sqlClient ?? null;
    this.httpClient = config.httpClient || this.createHttpClient();

    if (
      this.endpointType === "STORAGE_OPTIMIZED" &&
      this.pipelineType !== "TRIGGERED"
    ) {
      throw new Error(
        "Databricks storage-optimized endpoints only support TRIGGERED pipelineType.",
      );
    }

    if (
      this.endpointType === "STORAGE_OPTIMIZED" &&
      this.dimension % 16 !== 0
    ) {
      throw new Error(
        "Databricks storage-optimized endpoints require dimensions divisible by 16.",
      );
    }

    this.initialize().catch(console.error);
  }

  async initialize(): Promise<void> {
    if (!this._initPromise) {
      this._initPromise = this._doInitialize().catch((error) => {
        // A failed init (e.g. a cold/auto-suspended warehouse at startup) must not be cached
        // forever -- clear it so the next public call retries instead of replaying the
        // rejection. Every step is idempotent (CREATE ... IF NOT EXISTS / ensure*), so a
        // retry is safe.
        this._initPromise = undefined;
        throw error;
      });
    }

View on GitHub (pinned to 001c235229)

Solutions

  1. Switch endpointType to 'STANDARD', which has no divisibility constraint
  2. Or use an embedding model whose dimension is a multiple of 16 (OpenAI 1536/3072, many common models qualify)
  3. If you control the model, project/pad embeddings to a multiple of 16 before storing

Example fix

// before
new Databricks({ endpointType: 'STORAGE_OPTIMIZED', embeddingDimensions: 1000, ... });

// after
new Databricks({ endpointType: 'STANDARD', embeddingDimensions: 1000, ... });
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.endpointType === 'STORAGE_OPTIMIZED' && cfg.embeddingDimensions % 16 !== 0) {
  throw new Error(`dimension ${cfg.embeddingDimensions} not divisible by 16 — use endpointType STANDARD`);
}

Prevention

When it happens

Trigger: Using endpointType: 'STORAGE_OPTIMIZED' with an embedding dimension not divisible by 16 — e.g. 1536 is fine (96x16), but 1537, 768+1, or unusual custom-model dims like 1000 are not.

Common situations: Custom fine-tuned embedding models with arbitrary output sizes; truncating/padding embeddings by a few dims; choosing STORAGE_OPTIMIZED after previously using STANDARD with a non-multiple-of-16 dimension.

Related errors


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