Bug when exporting to Kindle KF8/mobi format in Scrivener 3.1

I am having a curious problem exporting projects to Kindle’s newer format in Scrivener 3.1 for macOS. It occurs whether I use the default ‘Ebook’ Scrivener format on export, or my own, self-created ebook export format (which is modification of the default).

On compile of the project (and I have tried with multiple projects, from every short (only six documents) to a full novel (with several hundreds), I encounter the same Scrivener error dialogue: “Kindle document creation failed. KindleGen failed to generate a .mobi file at the expected location.” This is followed by a Kindlegen error dialogue report box that reads as follows (I am placing in boldface the section that seems the most relevant):

[code]*************************************************************
Amazon kindlegen(MAC OSX) V2.9 build 1028-0897292
A command line e-book compiler
Copyright Amazon.com and its Affiliates 2014


Info(prcgen):I1047: Added metadata dc:Title “The Great White Whale”
Info(prcgen):I1047: Added metadata dc:Creator “A J Grayson”
Info(prcgen):I1047: Added metadata dc:Rights “© ® LBA Literary Agency, London; AJ Grayson”
Info(prcgen):I1002: Parsing files 0000009
Info(prcgen):I1015: Building PRC file
Info(prcgen):I1006: Resolving hyperlinks
Info(prcgen):I1008: Resolving start reading location
Error(prcgen):E24012: Epub Navigation file could not be built.
Warning(prcgen):W30013: Invalid “nav” element in Navigation file. Please refer to Kindle Publishing Guidelines about usage of EPUB3 Navigation support. A “nav” element can have two child elements, an optional heading and a mandatory ol ordered list in file: /private/var/folders/g3/zfm002h50zddd22svq6qfz080000gn/T/EBOOK_TEMP/TESTER Kindle - a6/contents.xhtml line: 8

Info(prcgen):I1016: Building enhanced PRC file
Info(prcgen):I1007: Resolving mediaidlinks
Info(prcgen):I1011: Writing mediaidlinks
Info(prcgen):I1009: Resolving guide items
Info(prcgen):I1038: MOBI file could not be generated because of errors!
[/code]

Again, this occurs on all projects, of any length and structure; and occurs when using the default Format export style, as well as my own.

When using the same export styles (either default or custom) to export the same projects to ePub 3 format, the export works without error and iBooks opens the end results which are formatted appropriately, including the TOC.

Any idea what is causing this?

Oddly, I was able to export to Kindle before, when using custom (hand-crafted from scratch) format styles — in Scrivener 3.0, but now it doesn’t work at all. I have no idea whether this is due to the upgrade to 3.1, or do to some inadvertent issue elsewhere.

I would appreciate any help.

TF

Similar?

https://forum.literatureandlatte.com/t/kindlegen-now-fails-in-scrivener-3-0-1-invalid-nav-element/39177/2

Unfortunately, no.

Same error codes for W30013: Invalid “nav” element in Navigation file and E24012: Epub Navigation file could not be built, but fair enough. Hope you find a resolution.

I have found a ‘solution’ to my own problem, though I share it here for further comment and as a potential ‘bug’ in Scrivener 3.0’s default export formats that might (I am not sure) need looking at.

I noticed that the fatal compile crash in Kindlegen that I reported in my initial post occurred with every project, of every size, and with all Kindle (new format) export compiles, whether I used the default ‘Ebook’ Scrivener export format, or my own customisation of it. However, on further testing, the error did not occur when I exported to this format using a designed-from-scratch export format that I hand crafted from the ground up myself. This gave me a control example to test against: if I could get the same project to compile successfully to the new Kindle format using my (minimalist) self-designed export style, which was very small, this gave me a very limited number of variables to test against with the default Scrivener ‘Ebook’ export style, to see if I could locate the problem.

It turns out, it appears to reside in the HTML Elements section of the export style settings. In my self-crafted-from-scratch style, I didn’t edit this pane at all, so all the settings for the five options within (Pages Title Style, Block Quotes Style, Code Blocks Style, Code Span Style, and Captions Style) were all set to a default of ‘None’ from their respective drop-down lists. However, in the default Scrivener ‘Ebook’ format style, these are pre-set in the following way:

Pages Title Style: Page Title Block Quotes Style: Block Quote Code Blocks Style: Code Block Code Span Style: Code Span Captions Style: Caption

(And thus they were also similarly set in my attempted custom-styles based off the standard Ebook style.)

This appears to be the source of the problem. When I took the default Ebook setting and created a copy of it, then edited it to set all these to ‘None’, compile and export to the latest Kindle format worked flawlessly for all projects; whereas with them set to these defaults, the crash spelled out in my original post occurred every time. I also set these to ‘None’ in my customised version of the Ebook style, and it thereafter worked properly.

I think this might have something to do with the fact that the Styles set in this pane are project-dependent, while the style is global and can be applied to any project — it appears that if the styles aren’t defined in the project itself, the compile crashes. (Again, this only affects Kindle format compiles; ePub compiles work fine with the default format.)

I do wonder whether this might constitute a ‘bug’, as the default format provided with Scrivener 3.x causes a Kindlegen crash error when applied to any project. Would it be better to set the defaults for these settings in the standard Scrivener Ebook format to ‘none’? Or perhaps there is another issue affecting this that I haven’t spotted.

Cheers, TF.

Actually this is the same bug as the others, but you have discovered a workaround. What is happening is if you unset the “Page title style” element setting (you don’t need to create a new compile format…):

Screen Shot 2017-12-23 at 09.24.50_SML.png

…then the

element is being placed outside the element and thus the spec violation is avoided:

Screen Shot 2017-12-23 at 09.23.31.png

Thanks. “Duplicate and Edit Format …” and Page title style: None worked

In Compile for: "Kindle KF8/Mobi Ebook (.mobi)
Look at Formats column
Click the + sign
Choose “Duplicate and Edit Format …”
Click “HTML Elements” in left column
Change “Page title style” to None
Save
Compile

I also am unable to export to .mobi now that I’ve upgraded to Scrivener 3.1. I tried the recommended fix (creating a new project format with all of the HTML Elements styles set to “None”. However, I’m still unable to make this work.

Any and all advice appreciated!

Thanks.

What version of KindleGen are you using? If you remove the old version, download Kindle Previewer and install that, it comes with a newer (and IIRC 64-bit) version of KindleGen. Scrivener should detect it and use it.

Only in Scrivener 3.1.5. Which I’d recommend installing anyway. – Katherine

Hi, any update on this? I am unable to generate any .mobi file using the latest kindlegen and the workaround of removing the HTML page title style…

Did you read the rest of the thread?

Make sure you’ve installed Scrivener 3.1.5, then remove KindleGen, and install Kindle Previewer.

KindlePreviewer includes a more current version of KindleGen, which Scrivener will use if available. That should resolve the issue.

Katherine

I thought I’d replied to this, but it seems my post has disappeared. I just came on to say I’m having this issue, even though Scrivner is up to date. Hoping to find a resolution to this soon! Thanks…