Docx files uploaded via Assistants end up with image/png mime type

When uploading some docx files using the Assistants API we are seeing 400 Failed to index file: Unsupported file file-7wpdbpdRHLfGLzB3lzL8AiTl type: image/png error_code: unhandled_mimetype

The file is successfully uploaded but never appears in the vector store. It doesn’t seem to happen with all docx files, but I have been unable to narrow down what is causing it beyond that. The docx files open correctly in Word, Pages and Google Docs.

Are you using the Playground or trying the Assistant via code? If code, please go ahead and add the code snippet for File Upload and Vector Stores.

Assistants via code.

  // upload file to openai if it is attached
  let uploadedFile: OpenAI.Files.FileObject | undefined = undefined;
  if (file) {
    // Upload the file to OpenAI with purpose "assistants"
    uploadedFile = await openai.files.create({
      file: file,
      purpose: 'assistants'
    });
    context.logger().info("Uploaded file: ", uploadedFile);
  }

Note this works perfectly, and I can see it in the upload section.

For PDFs or other files the whole process works, but for docx files it fails. It looks like the vector store gets created for other files but fails for docx files.