{"record":{"id":"c5bb63e82a49b947","repo":"BerriAI/litellm","slug":"error-calling-litellm-acompletion-for-generate-con","errorCode":null,"errorMessage":"Error calling litellm.acompletion for generate_content: {e}","messagePattern":"Error calling litellm\\.acompletion for generate_content: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/google_genai/adapters/handler.py","lineNumber":102,"sourceCode":"                    )\n                    return generate_content_response\n                else:\n                    # Transform streaming completion response to generate_content format\n                    transformed_stream: Final = GOOGLE_GENAI_ADAPTER.translate_completion_output_params_streaming(\n                        completion_response\n                    )\n                    if transformed_stream is not None:\n                        return transformed_stream\n                    raise ValueError(\"Failed to transform streaming response\")\n            else:\n                # Transform completion response back to generate_content format\n                generate_content_response = GOOGLE_GENAI_ADAPTER.translate_completion_to_generate_content(\n                    cast(ModelResponse, completion_response)\n                )\n                return generate_content_response\n\n        except Exception as e:\n            raise ValueError(f\"Error calling litellm.acompletion for generate_content: {e}\")\n\n    @staticmethod\n    def generate_content_handler(\n        model: str,\n        contents: list[dict[str, object]] | dict[str, object],\n        litellm_params: GenericLiteLLMParams,\n        config: dict[str, object] | None = None,\n        stream: bool = False,\n        _is_async: bool = False,\n        **kwargs: object,\n    ) -> dict[str, object] | AsyncIterator[bytes] | Coroutine[None, None, dict[str, object] | AsyncIterator[bytes]]:\n        \"\"\"Handle generate_content call using completion adapter\"\"\"\n\n        if _is_async:\n            return GenerateContentToCompletionHandler.async_generate_content_handler(\n                model=model,\n                contents=contents,\n                config=config,","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/google_genai/adapters/handler.py#L84-L120","documentation":"Wrapper around litellm.acompletion for the generate_content endpoint: the inner call raised (error text interpolated), and the adapter re-raises so callers see the underlying completion failure in the GenAI-compat context.","triggerScenarios":"Thrown at litellm/google_genai/adapters/handler.py:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped exception {e} for the root cause (auth, model name, provider outage).","Verify the model and credentials used by the underlying litellm.acompletion call."],"exampleFix":null,"handlingStrategy":"try-catch","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-23T08:17:48.524Z"}