mem0ai/mem0 · error · Error
No predictions returned from Vertex AI
Error message
No predictions returned from Vertex AI
What it means
After a successful client.predict() call, embed() requires response.predictions to be a non-empty array. Vertex AI returned a response with no prediction records (or a shape without predictions), which the SDK treats as a protocol-level failure instead of indexing into undefined.
Source
Thrown at mem0-ts/src/oss/src/embeddings/vertexai.ts:178
if (!(memoryAction in this.embeddingTypes)) {
throw new Error(`Invalid memory action: ${memoryAction}`);
}
embeddingType = this.embeddingTypes[memoryAction];
}
const instance = this.formatInstance(text, embeddingType);
const parameters = {
outputDimensionality: this.embeddingDims,
};
const [response] = await this.client.predict({
endpoint: this.endpoint(),
instances: [this.helpers.toValue(instance) as any],
parameters: this.helpers.toValue(parameters) as any,
});
if (!response.predictions || response.predictions.length === 0) {
throw new Error("No predictions returned from Vertex AI");
}
const decoded = this.helpers.fromValue(response.predictions[0] as any);
if (!isValidEmbedding(decoded)) {
throw new Error("Failed to extract embedding values from response");
}
return decoded.embeddings.values;
}
async embedBatch(
texts: string[],
memoryAction: "add" | "update" | "search" = "add",
): Promise<number[][]> {
if (!texts || texts.length === 0) {
return [];
}
View on GitHub (pinned to 001c235229)
Solutions
- Retry once: transient empty responses from regional endpoints do occur
- Verify the model is available and enabled in the exact region/location configured for the embedder
- Reproduce with a direct curl/gcloud aiplatform predict call to see the raw response
- Confirm you are on a current @google-cloud/aiplatform version and a stable (non-preview) model id
Defensive patterns
Strategy: retry
Type guard
function isNoPredictionsError(err: unknown): boolean {
return err instanceof Error && err.message === "No predictions returned from Vertex AI";
} Try / catch
async function embedRetry(text: string, tries = 2) {
for (let i = 0; ; i++) {
try { return await embedder.embed(text); }
catch (err) {
if (i < tries && err instanceof Error && err.message === "No predictions returned from Vertex AI") continue;
throw err;
}
}
} Prevention
- Confirm the embedding model is enabled in your project and region before deploying
- Retry once on empty predictions - regional endpoints occasionally return empty envelopes
- Monitor Vertex status pages for incidents in your region
When it happens
Trigger: Hitting a Vertex endpoint that returns an empty predictions list (model not enabled for the project, regional endpoint quirk, or a gateway/proxy stripping the field); passing a malformed instance that the service accepts but does not score; preview/new embedding models with a different response envelope.
Common situations: The aiplatform.googleapis.com embedding model is not enabled in the project/region; using a preview model id whose response shape differs; an intermediate proxy rewriting the gRPC/REST response.
Related errors
- No predictions returned from Vertex AI batch request
- Invalid memory action: ${memoryAction}
- Failed to extract embedding values from response
- Failed to extract embedding values from batch response
- Vertex AI embedBatch() returned ${allEmbeddings.length} embe
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/3ba7c76fc9e4a045.
Report an issue: GitHub.