mem0ai/mem0 · error · Error

Failed to get vector: ${error instanceof Error ? error.messa

Error message

Failed to get vector: ${error instanceof Error ? error.message : String(error)}

What it means

Catch-all around Cloudflare Vectorize getByIds: fetching a single vector by id failed (auth, network, index/account mismatch, or an unexpected response shape), and the error is rethrown wrapped as 'Failed to get vector: <message>'. A normal 'not found' returns null instead — this error means the API call itself failed.

Source

Thrown at mem0-ts/src/oss/src/vector_stores/vectorize.ts:146

    await this.initialize();
    try {
      const result = (await this.client?.vectorize.indexes.getByIds(
        this.indexName,
        {
          account_id: this.accountId,
          ids: [vectorId],
        },
      )) as any;

      if (!result?.length) return null;

      return {
        id: vectorId,
        payload: result[0].metadata,
      };
    } catch (error) {
      console.error("Error getting vector:", error);
      throw new Error(
        `Failed to get vector: ${error instanceof Error ? error.message : String(error)}`,
      );
    }
  }

  async update(
    vectorId: string,
    vector: number[],
    payload: Record<string, any>,
  ): Promise<void> {
    await this.initialize();
    try {
      const data: VectorizeVector = {
        id: vectorId,
        values: vector,
        metadata: payload,
      };

View on GitHub (pinned to 001c235229)

Solutions

  1. Check the inner message; 401/403 -> grant the token Vectorize:Read (edit) permission.
  2. Confirm indexName and accountId match the Cloudflare dashboard values.
  3. Retry on transient 5xx/network errors — get is a read and safe to retry.
Defensive patterns

Strategy: retry

Try / catch

try { return await memory.get(id); } catch (e) { const m = e instanceof Error ? e.message : ''; if (m.startsWith('Failed to get vector:')) { if (isTransientInner(m)) return retryWithBackoff(() => memory.get(id), 2); /* missing id is null, not this error */ throw new Error(m); } throw e; }

Prevention

When it happens

Trigger: memory.get(id) when the API token lacks read permission; indexName deleted; accountId wrong; network error during the REST call; Cloudflare API returning 5xx.

Common situations: Token scoped with Vectorize Write but not Read; pointing at another account's index; transient Cloudflare outages.

Related errors


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