I have an ePub that returns "mimetype entry missing or not the first in archive" error in epubcheck, even though the mimetype file is correctly placed.

How to fix that?

  • How do you know it is correctly placed? – mmmmmm Jan 5 '19 at 14:06

This error can occur when the mimetype is compressed inside the epub zip file. What can be done is to create a zip file with only the mimetype file inside but with no compression.

You can do that with 7-Zip setting the Compression level to Store.

In Linux, you can also do that with the terminal command:

zip -0 file.epub mimetype

Then drag and drop the META-INF and OEBPS folders to the file.zip and change the extension to .epub, as usual. With the Linux terminal you can use this command line instead:

zip -9 -r file.epub META-INF OEBPS
| improve this answer | |
  • So how do you achieve this on Windows using 7Zip? I tried different settings and approaches and i'm still getting the same error message. Is there any other tool that somebody can recommend to use? – invalidusername Mar 2 at 23:27

zip -X0 ../myEPUB.epub mimetype
zip -9 -r ../myEPUB.epub META-INF OEBPS

another common error i was getting was extra characters in mimetype 'Mimetype file should only contain the string 'application/epub+zip' and should not be compressed' I found that my editor Geany was adding a newline when I saved the file and this caused an epubcheck error - a tweak in Geany's preferences fixed this error and epubcheck returned no errors

| improve this answer | |

The trick is to SELECT the files in the order in which they are to be stacked.

For Windows users, do the following:

  1. Go to the folder that contains your ePub files.
  2. CTRL+CLICK to select your files in the following order: (a) mimetype, (b) META-INF folder, and then (c) OPS folder.
  3. With all three items are selected (in that order), RIGHT-CLICK, and then select Send To > Compressed (zipped) folder.
  4. Change your .zip file type to .epub.
  5. Run it through the ePub Validator to confirm the file.

Good luck!

| improve this answer | |
  • It would be useful to explain how do to get an option "Compressed (zipped) folder" in the "Send To" menu in the first place, as there are only options for messaging, email, burn to CD, backup and send via Bluetooth there. – Anthon Sep 17 '14 at 6:10
  • this doesn't work to get rid of the error message from epubchecker. – invalidusername Mar 2 at 23:29

7-zip sorts files by names

  1. rename mimetype to ##mimetype
  2. Add to archive... ##mimetype
    Archive: book.zip
    Archive format: zip
    Compression level: Store
  3. Add to archive... the other folders META_INF EPUB
    Archive: book.zip
    Archive format: zip
    Compression level: Normal
  4. Open archive... book.zip
    rename: ##mimetype to mimetype
  5. rename book.zip to book.epub
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.