{"record":{"id":"21af05cadae7c007","repo":"mem0ai/mem0","slug":"no-predictions-returned-from-vertex-ai-batch-reque","errorCode":null,"errorMessage":"No predictions returned from Vertex AI batch request","messagePattern":"No predictions returned from Vertex AI batch request","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/embeddings/vertexai.ts","lineNumber":229,"sourceCode":"      const chunk = texts.slice(i, i + batchSize);\n      const instances = chunk.map(\n        (text) =>\n          this.helpers!.toValue(\n            this.formatInstance(text, embeddingType),\n          ) as any,\n      );\n      const parameters = {\n        outputDimensionality: this.embeddingDims,\n      };\n\n      const [response] = await this.client.predict({\n        endpoint: this.endpoint(),\n        instances,\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 batch request\");\n      }\n\n      for (const prediction of response.predictions) {\n        const decoded = this.helpers.fromValue(prediction as any);\n        if (!isValidEmbedding(decoded)) {\n          throw new Error(\n            \"Failed to extract embedding values from batch response\",\n          );\n        }\n        allEmbeddings.push(decoded.embeddings.values);\n      }\n    }\n\n    if (allEmbeddings.length !== texts.length) {\n      throw new Error(\n        `Vertex AI embedBatch() returned ${allEmbeddings.length} embeddings for ${texts.length} texts using model '${this.model}'`,\n      );\n    }","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/embeddings/vertexai.ts#L211-L247","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the batch: transient empty responses do occur under load","Confirm the embedding model is enabled in the exact region/location the embedder uses","Reduce batch pressure or chunk sizes and observe whether specific chunks consistently fail, then report with the model id and region","Bypass any proxy and call Vertex directly to isolate where predictions are lost"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"function isBatchNoPredictions(err: unknown): boolean {\n  return err instanceof Error && err.message === \"No predictions returned from Vertex AI batch request\";\n}","tryCatchPattern":"async function batchRetry(texts: string[], action = \"add\" as const, tries = 2) {\n  for (let i = 0; ; i++) {\n    try { return await embedder.embedBatch(texts, action); }\n    catch (err) {\n      if (i < tries && err instanceof Error && err.message.includes(\"batch request\")) continue;\n      throw err;\n    }\n  }\n}","preventionTips":["Verify the model is enabled in the configured region before batching","Retry batches once - empty envelopes are usually transient","Bypass proxies when debugging to isolate where predictions disappear"],"tags":["vertexai","batch","embeddings","protocol","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}