ePUB conversion errors

I am trying to compile my novel into ePUB format (Mac 3.1.2). When I try to view the file with Kindle Previewer 3, I get a conversion error message with a log of errors which make no sense to me.
My novel has images on 6 pages but otherwise it’s a fairly standard text format for novels with footnotes on the occasional page.
Has anybody else encountered this problem when compiling for ePUB? How did you get around it? I’m guessing my problem is not unique so any advice would be most helpful.
Attached screenshot of the log of errors.

If I use iBooks to open the file, I get various errors in chapters. Most are incomprehensible to me:
“error on line 17 at column 29: Opening and ending tag mismatch: div line 0 and p”

Has anybody else had similar issues when compiling ebooks?

Attached image for errors when trying to open compiled file through iBooks.

The most recent version of Scrivener is 3.1.5. Do you still see the errors if you update?


I’ve updated to 3.1.5 and the errors have disappeared.
Thanks Katherine!

Since the original error log points to an issue in the ToC, I’d go back and review the instructions provided in the user manual, under §22.2, Contents in Ebooks—particularly those in the yellow tip box.

One quick way to determine if this is the source of the problem is to remove your custom ToC section from the Draft and let Scrivener generate one automatically. If that passes inspection, then it’s very likely there is an issue with the formatting in the custom ToC.

That might not be the only problem though. Really the best way to examine these is to open your .epub file in an editor, like Sigil or Calibre, and follow where the error messages take you. They should point to an internal file name, line number and sometimes column number, but once you get to the general area if there are problems with the HTML, it should be easy to spot them, and then trace back to the original project and see if there is something in the editor that may cause that problem.

I’d also suggest using a better validation tool, as it looks like Kindle Previewer’s log lists problems by its own internal temporary conversion system rather than the actual .epub file you gave it. ePubCheck is a good one (though it needs Java installed). There are online checkers based on that tool.

Hi, I’m seeing this error and I’m using Scrivener version 3.2.1 . I do not have a custom ToC

Given the great quantity of potential variables involved, it’s really hard to say what’s going on from over here. Like I say, it’s often best to look at the source itself in Sigil. Apple’s Books isn’t really a debugging environment.

I ended up “solving” it by deleting content, and re-adding it. I suspect that S has issues with formatted text which then goes into the converter to epub.

This is actually happening very frequently in different areas of the book. Is there someone who can actually take alook at this ? is there a place to submit bugs ?

I’m attaching an absolute minimal bug where this happens. Just compile this project, and open in books on macos to reproduce.

You can open a support ticket here:



The line breaks between “bug” and “here” are causing a closing span to appear in the wrong place:





Should be:





However, if the line breaks are replaced with paragraph returns, the ePub compiles cleanly (at least it does in my test compiles).

EDIT: removing the font colour or assigning a / the colour for each line separately (even with line breaks) does work.

Hey, thanks for digging into this. I’ve passed your findings along to the Scrivener support team. Hopefully their developers can look at it and fix it.

actually, is there a way to remove all the spans altogether? I have no need for selecting color etc since it’s going to an epub. IOW, is there a way to strip all such formatting from within scrivener ?

Update: Ahh, yes, I selected the text and chose “Text Color → Remove Color” from the context menu, and that solved the problem. Thanks!!

Option number 2 is choosing “Remove text color” during compile :slight_smile:

I should point out that these are workarounds for only issues with span that’s related to color. I’ve since (already) run into issues where color isn’t the problem, and the span is causing issues elsewhere (in lists)

I think you have identified a genuine bug. The workarounds shouldn’t be needed.

Hopefully all will be sorted out soon thanks to the feedback you have given.

Ah yeah, it looks like the bug here is in how sequential line feeds are handled. The way they should be output is like this:

<p><span ...>stuff<br/> <br/> more stuff</span></p>

But it looks like an empty line with a line feed gets a paragraph break inserted, which is causing invalid output. If you change your example so that each line is adjacent, then it should work.