## The problem
Issue pydantic/pydantic-ai#631 (closed, 35 comments): I've been getting these sporadically when using Gemini: ``` Traceback (most recent call last): File "/workspaces/cardcraft/.venv/lib/python3.12/site-packages/pydantic_ai/agent.py", line 249, in run model_response, request_usage = await agent_model.request(messages, model_settings) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/workspaces/cardcraft/.venv/lib/python3.12/site-packages/pydantic_ai/models/gemini.py", line 176, in request response = _gemini_response_ta.validate_json(await http_response.aread()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File...
## What to do
pydantic-ai surfaces Gemini's MALFORMED_FUNCTION_CALL finish reason when the model fumbles a function call. There is no library fix; the reliable mitigation from the thread is to simply retry the same request, since the failure is transient on the model's side (one user confirmed resending the exact prompt works). If it happens constantly rather than sporadically, simplify your tool schemas: complex tool definitions make Gemini produce malformed calls more often.