Ebooks Asked on January 6, 2022
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?
As the accepted answer states, the mimetype file should be stored uncompressed in the archive. For those looking for a programmatic way to validate and package an EPUB I recommend using the Java EPUBCheck tool by W3C. You can use it as a command line tool and as a Java library. The tool allows you to validate an expanded EPUB folder and save it as an EPUB compressed archive upon successful validation.
java -jar epubcheck.jar epub/ --mode exp --save
Read the wiki.
Answered by valentin on January 6, 2022
Here are the steps I used to force the "mimetype" file to be the first in the EPUB archive using 7-Zip in Windows:
Make a copy of your EPUB (zip) file (e.g. MyBookCopy.epub), so to not damage your original EPUB file in case things go wrong.
Extract all of the files from MyBookCopy.epub into an empty folder (e.g. MyFolder)
Using the 7-zip UI, delete all the files in MyBookCopy.epub except the “mimetype” file
Using the 7-zip UI, rename the “mimetype” file to “##mimetype” (this will ensure it remains listed first under the covers)
Using the 7-zip UI, re-add all the other epub files in MyFolder into your EPUB file (i.e. drag & drop all these files into the 7-zip window where your epub is open)
Using the 7-zip UI, rename the “##mimetype” file back to “mimetype” (this will not alter its actual order in the ZIP file, even if its order changes in the UI)
Note: At any time, you can verify the actual order of the files in your EPUB file by running this command in a command prompt window: 7z l -slt "MyBookCopy.epub" (in the resulting output, locate the entry for the “mimetype” file and check that its “offset” value is “0” which means it’s the first file stored in the EPUB file).
Answered by Pi Da on January 6, 2022
7-zip sorts files by names
Answered by fstil on January 6, 2022
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
Answered by Jonathan O'Gorman on January 6, 2022
The trick is to SELECT the files in the order in which they are to be stacked.
For Windows users, do the following:
Send To > Compressed (zipped) folder.
Answered by John on January 6, 2022
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
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
Answered by Allan Veloso on January 6, 2022
5 Asked on June 20, 2021 by elixenide
1 Asked on June 19, 2021 by carllacan
0 Asked on June 16, 2021
0 Asked on June 11, 2021
7 Asked on May 19, 2021
1 Asked on May 7, 2021
0 Asked on April 30, 2021 by rmc
5 Asked on April 21, 2021 by caleb
1 Asked on April 3, 2021 by sean-simpson
1 Asked on March 29, 2021
7 Asked on March 23, 2021 by dvk
2 Asked on March 22, 2021
0 Asked on March 18, 2021
5 Asked on March 16, 2021 by rdiger-kupper
0 Asked on March 15, 2021 by ray-n-franklin
0 Asked on March 8, 2021
Get help from others!