mem0ai/mem0 · error · Error

No predictions returned from Vertex AI batch request

Error message

No predictions returned from Vertex AI batch request

What it means

Inside embedBatch(), each chunked client.predict() call must return at least one prediction. An empty predictions array for a batch request is treated as a protocol failure: partial or missing results would break the alignment between texts and vectors, so the whole batch aborts.

Source

Thrown at mem0-ts/src/oss/src/embeddings/vertexai.ts:229

      const chunk = texts.slice(i, i + batchSize);
      const instances = chunk.map(
        (text) =>
          this.helpers!.toValue(
            this.formatInstance(text, embeddingType),
          ) as any,
      );
      const parameters = {
        outputDimensionality: this.embeddingDims,
      };

      const [response] = await this.client.predict({
        endpoint: this.endpoint(),
        instances,
        parameters: this.helpers.toValue(parameters) as any,
      });

      if (!response.predictions || response.predictions.length === 0) {
        throw new Error("No predictions returned from Vertex AI batch request");
      }

      for (const prediction of response.predictions) {
        const decoded = this.helpers.fromValue(prediction as any);
        if (!isValidEmbedding(decoded)) {
          throw new Error(
            "Failed to extract embedding values from batch response",
          );
        }
        allEmbeddings.push(decoded.embeddings.values);
      }
    }

    if (allEmbeddings.length !== texts.length) {
      throw new Error(
        `Vertex AI embedBatch() returned ${allEmbeddings.length} embeddings for ${texts.length} texts using model '${this.model}'`,
      );
    }

View on GitHub (pinned to 001c235229)

Solutions

  1. Retry the batch: transient empty responses do occur under load
  2. Confirm the embedding model is enabled in the exact region/location the embedder uses
  3. Reduce batch pressure or chunk sizes and observe whether specific chunks consistently fail, then report with the model id and region
  4. Bypass any proxy and call Vertex directly to isolate where predictions are lost
Defensive patterns

Strategy: retry

Type guard

function isBatchNoPredictions(err: unknown): boolean {
  return err instanceof Error && err.message === "No predictions returned from Vertex AI batch request";
}

Try / catch

async function batchRetry(texts: string[], action = "add" as const, tries = 2) {
  for (let i = 0; ; i++) {
    try { return await embedder.embedBatch(texts, action); }
    catch (err) {
      if (i < tries && err instanceof Error && err.message.includes("batch request")) continue;
      throw err;
    }
  }
}

Prevention

When it happens

Trigger: A chunk larger than what the endpoint accepts being silently dropped; regional endpoint returning an empty envelope under load; a proxy stripping predictions from the gRPC response; model not enabled in the configured location so predict returns empty rather than erroring.

Common situations: Large batches exceeding the model's per-request instance limit combined with gateway misbehavior; projects where the embedding model is enabled in us-central1 but the embedder is configured for another region; transient Vertex incidents.

Related errors


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