Hi Google Team,
I created a PDF file using the Code Execution tool, and when I try to pass the generated PDF back in a subsequent generateContent api request, I am getting the following exact error:
[
{
"error": {
"code": 400,
"message": "The mime type: application/pdf is not supported for code execution.",
"status": "INVALID_ARGUMENT"
}
}
]
I tried passing the PDF in both ways:
- Using
fileDatawith the PDFfileUri - Using
inlineDatawith the PDF content
However, both approaches are throwing the same error.
I also tried this with multiple models:
- Gemini 3.5 Flash
- Gemini 3.6 Flash
- Gemini 3.1 Flash-Lite
- Gemini 3.1 Pro Preview
I am getting the same error with all of these models.
Earlier, this was working for us, and we were able to pass the generated PDF back to generateContent api and modify it using Code Execution. Recently, the same request has started failing with the above error.
In this previous discussion, it was suggested to convert the file to PDF and then use the PDF as the input:
Could you please help us understand why PDF input is no longer working with Code Execution? Has there been any recent change or restriction regarding PDF files as input?
If PDF input with Code Execution is still supported, could you please help us understand why we are now receiving this error with both fileData and inlineData across the above models?
Also, could you please let us know if there is any solution or workaround available for this? We would really appreciate your guidance on the recommended approach.
Thank you for your help.