{"record":{"id":"3ba7c76fc9e4a045","repo":"mem0ai/mem0","slug":"no-predictions-returned-from-vertex-ai","errorCode":null,"errorMessage":"No predictions returned from Vertex AI","messagePattern":"No predictions returned from Vertex AI","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/embeddings/vertexai.ts","lineNumber":178,"sourceCode":"      if (!(memoryAction in this.embeddingTypes)) {\n        throw new Error(`Invalid memory action: ${memoryAction}`);\n      }\n      embeddingType = this.embeddingTypes[memoryAction];\n    }\n\n    const instance = this.formatInstance(text, embeddingType);\n    const parameters = {\n      outputDimensionality: this.embeddingDims,\n    };\n\n    const [response] = await this.client.predict({\n      endpoint: this.endpoint(),\n      instances: [this.helpers.toValue(instance) as any],\n      parameters: this.helpers.toValue(parameters) as any,\n    });\n\n    if (!response.predictions || response.predictions.length === 0) {\n      throw new Error(\"No predictions returned from Vertex AI\");\n    }\n\n    const decoded = this.helpers.fromValue(response.predictions[0] as any);\n    if (!isValidEmbedding(decoded)) {\n      throw new Error(\"Failed to extract embedding values from response\");\n    }\n\n    return decoded.embeddings.values;\n  }\n\n  async embedBatch(\n    texts: string[],\n    memoryAction: \"add\" | \"update\" | \"search\" = \"add\",\n  ): Promise<number[][]> {\n    if (!texts || texts.length === 0) {\n      return [];\n    }\n","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/embeddings/vertexai.ts#L160-L196","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"function isNoPredictionsError(err: unknown): boolean {\n  return err instanceof Error && err.message === \"No predictions returned from Vertex AI\";\n}","tryCatchPattern":"async function embedRetry(text: string, tries = 2) {\n  for (let i = 0; ; i++) {\n    try { return await embedder.embed(text); }\n    catch (err) {\n      if (i < tries && err instanceof Error && err.message === \"No predictions returned from Vertex AI\") continue;\n      throw err;\n    }\n  }\n}","preventionTips":["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"],"tags":["vertexai","embeddings","protocol","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}