Compile as epub error

I tried to Compile a mss. as epub and received several incidents of an error message:

error on line x at column x PCDATA invalid Char data X.

Other error messages were similar except for character data #. I wrote the document in Scrivener with user-defined formatting. On the off-chance this was a problem due to a paste from another app, I tried Select All and reapplied formatting, but it didn’t correct the problem.

Any suggestions?
JHH

(Best to backup your project first…)

Use paste and match style from the edit menu.
Then, reapply formatting.

So: Select all, Copy, Paste and match style, reformat.
. . . . . . .

You could also use Sigil to have a look at the precise reported locations, in the compiled epub file, and see what the error really is about.

Repasting everything as I explained above is not only time consuming, but might not be the fix you need at all.

Worst case scenario, test by fixing and compiling a single chapter in which an error is reported.

1 Like

Hi Vincent - thanks for your quick reply. I save and back up constantly!

I use keystrokes to apply formatting in Scrivener.

Don’t use Paste from another app very often, but when I do, I select the paragraph, or the entire text, and reapply my format using the keystroke.

Looks like Past and Match Style would strip any formatting from the original document and then I could apply my own. I’ll give that a try.

But the problem seems unique to Compile: I don’t get these error messages when I choose Print: Save as pdf or Compile as pdf.
JHH

An epub/ebook is a mini-website (sort of). Very capricious.

1 Like

PS: I just copied two paragraphs from another word processor, pasted them directly into Scrivener, then pasted them again using Paste and Match Style. Compiled that one chapter and did not receive any error messages. So it doesn’t seem to be a Paste issue.

I’ve also pasted the text into other word processors and exported to epub with no problems.

This mss is 500+ pages 200K+ words., so these error messages are relatively infrequent. The text has been edited many times, you’d think the problem would occur more often.

If I get the error message in the future, is there a Find I can use to correct it?

JHH

These “errors” or “incompatibilities” are invisible to you in the editor. So, not really.
You’d have to use Sigil.

But, again, it’d be best to know the precise nature of the said error before speaking of maneuvers…

. . . . . .

Pasting from elsewhere won’t systematically generate an error…

It is to be avoided. Use Paste and match style always.
But (otherwise)… sometimes things go south, sometimes not.

Paste and match style strips the text of any foreign formatting. Should there be an issue in the making, and IF that’s where (foreign formatting) the issue is from, using that function guarantees there won’t be an issue.

It is kind of like wearing a helmet. You don’t just put it on when there is a rock falling. :wink:

1 Like

Hi Vincent: Just did a Paste and Match Style on the two chapters before and after the error message and it solved the problem! Clearly there was something lurking in there out of sight. Lesson learned. Thanks for your help – wish I’d learned this before my deadline – it would have saved me from a very frustrating all-nighter. JHH

3 Likes

Troubleshooting procedure for this error is:

  1. Find the exact location of the error in the project.

  2. Look for invisible formatting commands (View → Text Editing → Show Invisibles).

  3. Edit → Text Tidying → Zap Gremlins.

  4. Paste and Match Style from the original source (if available).

If none of that helps, you’ll need to use Sigil or similar to look directly at the output file. (Even if looking at the HTML doesn’t help you, someone here may be able to interpret it.)

1 Like

Thanks Kewms: I regularly Show Invisibles, and didn’t see anything. Did not know about Zap Gremlins – Gremlins, no less! What’s not to like?

I will use both commands in the future (Paste and Match, and Gremlins), to clean things up, and expect that will solve the problem.

Sigil? Not familiar with it. Looks like more firepower than I need since I don’t export epubs very often. But since it’s free, maybe worth having on hand?

JHH

1 Like

Definitely.
. . . . . . . . . . . .

2 Likes

Sigil install failed: Developer cannot be verified. I’m on OS 14.5 with an Apple MI Max. I downloaded the Apple ARM64 and got a file with extension txz.

Now what?

That’s your Mac OS security settings talking. Look at the Security section of the Apple → System Settings → Privacy and Security pane.

Solved the error message problem, thanks to all your help, but now having a different, bigger problem with Compile.

The Scrivener epub file crashes Books, every single time. Calibre can’t open it. I tried with both Default Format and epub Format. Same problem. Not doing anything fancy here – just accepted the built in format, no adjustments.

Thinking something was wrong in my Project, I made a new Project, copied and pasted three files from the original Project, (I zapped Gremlins on them, tried with and without Paste and Match Style), and tried Compile – no problem with result.

epub is also fine if I copy a Scrivener file into Libre Office. Ditto into Mellel. (I don’t have Word).

So it doesn’t look like corrupt files – it seems to be something in my original Scrivener Project – probably did something weird with settings that I’d like to undo.

Anybody got a suggestion how to reset this? JHH

Is it not a valid Zip-file? Try opening it in 7-zip, to see if you get a meaningful error message. No need to rename to .zip…

Sorry; don’t understand. Is what a valid Zip-file? When I compile a group of documents from within my Scrivener Project, the resulting file goes into Finder with the extension epub, or pdf, or whatever. I’m not dealing with any zip files.

Actually… you do: “An EPUB publication is delivered as a single file. This file is an unencrypted zipped archive …”

2 Likes