Gemini generateContent API: DOCX generated by Code Execution cannot be used as input (Unsupported MIME type)

Hi Google team,

I’m using the Gemini generateContent API with Gemini 3.5 Flash.

My workflow is as follows:

  1. Use Gemini Code Execution to generate a .docx file.
  2. The DOCX file is generated successfully.
  3. In a subsequent generateContent API call, I try to provide the same DOCX as input using fileData.

The request fails with the following error:

{
  "error": "Unsupported MIME type: application/vnd.openxmlformats-officedocument.wordprocessingml.document",
  "statusCode": 400
}

The MIME type I’m sending is:

application/vnd.openxmlformats-officedocument.wordprocessingml.document

My questions are:

  1. Is this expected behavior for the generateContent API?
  2. If Code Execution can generate a DOCX artifact, why can’t the same DOCX be provided as input to a subsequent generateContent request?
  3. Is DOCX currently unsupported as an input format for generateContent, or is this a bug?
  4. Are there any plans to support this workflow in the future?

Has anyone else encountered this issue or found a supported workaround?

Thank you.

Hello @Sudheer_Narkidimilli ,

It’s true that we don’t support docx as an input format. There are actually many formats the models can generate since their format is in the training data, but that doesn’t mean they can read them all.

At the moment we don’t have any plans to support docx as an input file type. I would suggest converting it to a PDF.