Skip to main content

office_document_invalid

HTTP 422 · code: "office_document_invalid" · type: https://docs.formfeed.dev/errors/office-document-invalid

The file looks like an office document, but its container is damaged or fails one of the safety checks every document goes through before it is converted or filled: documents sent to /pdf/convert and the files of Word and PowerPoint templates. detail says what is wrong; entry, where present, names the part of the file. Nothing was charged.

Example​

{
"type": "https://docs.formfeed.dev/errors/office-document-invalid",
"title": "Office document invalid",
"status": 422,
"detail": "Part word/document.xml is corrupt",
"code": "office_document_invalid",
"location": null,
"entry": "word/document.xml",
"request_id": "req_4b7c1e9a2f3d4c5b8a6e7f9012"
}

Common causes​

  • A file that was cut off during upload or download (The file is not a valid ZIP container, The ZIP central directory is corrupt, Part … cannot be decompressed).
  • A document whose XML declares a DOCTYPE or an ENTITY, which office applications never write (The document declares a DOCTYPE).
  • A container with duplicate or unsafe entry names (../, absolute paths), more than 2,000 entries, or an unsupported compression method, usually made by a tool rather than Word, Excel or PowerPoint.
  • A damaged Word 97–2003, Excel or PowerPoint binary file (The compound document is corrupt).

How to fix it​

  • Open the file in Word, Excel, PowerPoint or LibreOffice and save it again under a new name.
  • Check that your upload sends the file's bytes unchanged (no text encoding, no base64 in a form field).

Retry?​

No. The same file gives the same answer. Change the file, then send the request again with a new Idempotency-Key or without one: a 4xx answer is stored under its key for 24 hours, so the old key returns this problem again. See retrying.