{"record":{"id":"ca18910bc9953ff4","repo":"BerriAI/litellm","slug":"nested-input-list-must-not-be-empty","errorCode":null,"errorMessage":"Nested input list must not be empty","messagePattern":"Nested input list must not be empty","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py","lineNumber":240,"sourceCode":"    into a single content with multiple parts, producing one combined\n    embedding for the group.\n\n    Examples:\n        input=[\"text\", \"image\"]         → 2 separate embeddings\n        input=[[\"text\", \"image\"]]       → 1 combined embedding\n        input=[[\"text\", \"image\"], \"x\"]  → 2 embeddings (1 combined + 1 separate)\n    \"\"\"\n    gemini_model_name: Final = f\"models/{model}\"\n\n    gemini_params: Final = _filter_embed_params(optional_params)\n\n    input_list: Final = [input] if isinstance(input, str) else input\n    requests: Final[list[EmbedContentRequest]] = []\n\n    for element in input_list:\n        if isinstance(element, list):\n            if not element:\n                raise ValueError(\"Nested input list must not be empty\")\n            for sub in element:\n                if not isinstance(sub, str):\n                    raise ValueError(f\"Elements inside a nested input list must be strings, got {type(sub)}\")\n            parts = [_build_part_for_input(sub, resolved_files=resolved_files) for sub in element]\n        else:\n            parts = [_build_part_for_input(element, resolved_files=resolved_files)]\n        request = EmbedContentRequest(\n            model=gemini_model_name,\n            content=ContentType(parts=parts),\n            **gemini_params,\n        )\n        requests.append(request)\n\n    return VertexAIBatchEmbeddingsRequestBody(requests=requests)\n\n\ndef transform_openai_input_gemini_embed_content(\n    input: GeminiEmbeddingInput,","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py#L222-L258","documentation":"Gemini batch-embed input guard: a nested list element (a combined-embedding group) is empty, so no parts could be produced for that content and the request is rejected rather than sending an empty content block.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/gemini_embeddings/batch_embed_content_transformation.py:240 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-empty list of strings inside the nested input list; remove empty inner lists before calling the API.","Filter the input, e.g. input = [lst for lst in input if lst], or ensure each inner list contains at least one string."],"exampleFix":null,"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"}