mem0ai/mem0 · error · Error

Baidu Mochow table '${label}' stores ${dimension}-dimensiona

Error message

Baidu Mochow table '${label}' stores ${dimension}-dimensional vectors, but 'embeddingModelDims' is ${this.embeddingModelDims}.

What it means

After schema validation, the Baidu store compares the table's vector field dimension (if defined) against the configured embeddingModelDims and throws when they differ. Inserting vectors of the wrong dimension into Mochow would fail server-side, so this check catches the mismatch up front with both numbers in the message.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/baidu.ts:377

    const indexes = schema?.indexes ?? [];
    const field = (name: string) => fields.find((f) => f.fieldName === name);
    const typeOf = (name: string) => String(field(name)?.fieldType ?? "");
    const label = `${this.databaseName}.${this.tableName}`;

    if (
      typeOf("id") !== "STRING" ||
      !typeOf("data").startsWith("TEXT") ||
      typeOf("vector") !== "FLOAT_VECTOR" ||
      typeOf("metadata") !== "JSON"
    ) {
      throw new Error(
        `Baidu Mochow table '${label}' exists but is missing the id/data/vector/metadata schema mem0 requires. Drop it, or point 'tableName' at an unused table.`,
      );
    }

    const dimension = field("vector")?.dimension;
    if (dimension !== undefined && dimension !== this.embeddingModelDims) {
      throw new Error(
        `Baidu Mochow table '${label}' stores ${dimension}-dimensional vectors, but 'embeddingModelDims' is ${this.embeddingModelDims}.`,
      );
    }

    this.supportsKeywordSearch =
      typeOf("textLemmatized").startsWith("TEXT") &&
      indexes.some((index) => index.indexName === BM25_INDEX);

    if (!this.supportsKeywordSearch) {
      console.warn(
        `Baidu Mochow table '${label}' has no '${BM25_INDEX}' inverted index. keywordSearch() will return null until the table is recreated.`,
      );
    }
  }

  async initialize(): Promise<void> {
    if (!this._initPromise) {
      this._initPromise = this.ensureTable().catch((error) => {

View on GitHub (pinned to 001c235229)

Solutions

  1. Set vectorStore config embeddingModelDims to the actual output dimension of your embedder, matching the number in the error.
  2. If the table must keep its dimension, switch the embedder to one producing that dimension.
  3. If you intend to change dimensions, drop the table and let mem0 recreate it (existing vectors cannot be migrated).

Example fix

// before
embedder: { provider: 'huggingface', config: { model: 'BAAI/bge-m3' } },
vectorStore: { provider: 'baidu', config: { embeddingModelDims: 1536, ... } }
// after
vectorStore: { provider: 'baidu', config: { embeddingModelDims: 1024, ... } }
Defensive patterns

Strategy: validation

Validate before calling

function assertDimsMatch(configDims: number | undefined, tableDims: number | undefined, embedder: { dims: number }) {
  const expected = configDims ?? embedder.dims;
  if (tableDims !== undefined && tableDims !== expected)
    throw new Error(`embeddingModelDims (${expected}) != table dimension (${tableDims}); recreate table or change embedder`);
}

Try / catch

try { await memory.add(text) } catch (e) { if (e instanceof Error && /-dimensional vectors, but 'embeddingModelDims' is/.test(e.message)) { /* stop producer; fix dims; reindex */ } throw e; }

Prevention

When it happens

Trigger: Table created with 1024-dim vectors (e.g. BGE) but embeddingModelDims left at the default (1536); switching the embedder to another model without recreating the table; explicitly setting embeddingModelDims inconsistently with the embedder's real output.

Common situations: Changing embedding providers (openai text-embedding-3-small 1536 vs bge-m3 1024) after data already exists; copy-pasted config where dims were never aligned.

Related errors


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