{"record":{"id":"7d65f286cf87a84c","repo":"BerriAI/litellm","slug":"body-on-v1-embeddings-batch-requests-must-be-a","errorCode":null,"errorMessage":"`body` on /v1/embeddings batch requests must be a JSON object, but was missing or not an object","messagePattern":"`body` on /v1/embeddings batch requests must be a JSON object, but was missing or not an object","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/files/transformation.py","lineNumber":477,"sourceCode":"    Transforms a single OpenAI `/v1/embeddings` batch entry into Vertex Gemini Embedding\n    batch rows, one per requested embedding.\n\n    Example Vertex jsonl\n    {\"key\": \"id_1\", \"request\": {\"content\": {\"parts\": [{\"text\": \"Hello World\"}]}, \"output_dimensionality\": 768, \"task_type\": \"RETRIEVAL_DOCUMENT\"}}\n\n    Note that `content` is singular (an `EmbedContentRequest`, not a\n    `GenerateContentRequest`) and that the `custom_id` round-trips through the top-level\n    `key`. An `EmbedContentRequest` returns exactly one vector, so an entry whose `input`\n    is an array fans out into one row per element and is reassembled on the way back.\n    The docs put the per-row config in an `embed_content_config` sibling of `request`,\n    but the API rejects that key outright and fails the whole batch job, so the config\n    fields go inside the `EmbedContentRequest` itself.\n\n    API Ref: https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/batch-prediction-genai-embeddings\n    \"\"\"\n    openai_request_body = openai_entry.get(\"body\")\n    if not isinstance(openai_request_body, dict):\n        raise TypeError(\n            \"`body` on /v1/embeddings batch requests must be a JSON object, but was missing or not an object\"\n        )\n    embedding_input = openai_request_body.get(\"input\")\n    if embedding_input is None:\n        raise ValueError(\"`input` is required on /v1/embeddings batch requests, but was not provided\")\n\n    elements = _openai_embedding_input_elements(embedding_input)\n    if not elements:\n        raise ValueError(\"`input` on /v1/embeddings batch requests must not be empty\")\n\n    embed_content_requests = tuple(\n        transform_openai_input_gemini_embed_content(\n            input=element,\n            model=openai_request_body.get(\"model\", \"\"),\n            optional_params=openai_request_body,\n        )\n        for element in elements\n    )","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/files/transformation.py#L459-L495","documentation":"Validation while transforming an OpenAI /v1/embeddings batch entry to Vertex Gemini JSONL: the entry's body is missing or not a JSON object, so the required EmbedContentRequest cannot be built. The input at fault is the 'body' field of the JSONL line.","triggerScenarios":"Triggered when the body of a /v1/embeddings batch request is missing or not a JSON object.","commonSituations":"See trigger scenarios.","solutions":["Send the batch request body as a JSON object.","Include a valid request body on the /v1/embeddings batch request."],"exampleFix":"# ensure each batch line has a JSON object body.","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}