45 Fix Validation Errors

Pressbooks EPUB and PDF files are made to be compatible with the submission specifications at all major ebook stores and print-on-demand services. However, sometimes markup that isn’t compatible with the EPUB or PDF file formats can be imported into Pressbooks when you bring in your content. We recommend testing your files before you submit them to your distributor of choice to make sure they pass all specifications.

Email Yourself Validation Logs

You can decide whether or not you want to receive validation logs for all your exported files. To enable or modify this setting:

  1. Go to Settings > Export from the left sidebar menu in Pressbooks
  2. Next to “Email Validation Logs,” choose either “Yes” or “No”
  3. Click Save Changes 

By default, all books’ Email Validation Log setting is set to “No. Ignore validation errors.” If you choose to receive validation logs (or error reports) from Pressbooks, all file validation error logs will be forwarded to the email address associated with your Pressbooks account.

Export Settings screen on Pressbooks.com

Afterward, you’ll receive a message whenever any file you export has an error. You’ll know exported files contain errors if you see a banner at the top of the Export screen that reads: “Warning: The export has validation errors. See logs for more details.”

Export validation error banner on the Exports screen.

Each type of file is validated against different standards, so their validation logs will also differ. 

Interpret EPUB Validation Logs

EPUB validation logs will appear in your email inbox with the following subject line: Pressbooks\Modules\Export\Epub\

Below is an example of what an error report may look like.

Array
(
[time] => Mon Dec 10 22:17:33 2018
[user] => tmcgrath
[site_url] => https://yourbooktitle.pressbooks.com/wp
[blog_id] => 107381
[theme] => Atwood
)
ERROR(RSC-020): /srv/www/pressbooks.com/releases/20181205114740/web/app/uploads/sites/107381/pressbooks/exports/Test-Book-2-1544480239.epub/OEBPS/chapter-056-your-chapter.html(26,268): ‘http://bit.ly/btb-v092″>http://bit.ly/btb-v092′ is not a valid URL.

Check finished with errors.

This sample validation log can be broken down into parts. The initial Array includes specific metadata about your book. You’ll see the time the book was exported, the username of the person who exported the book, and the URL of the book in Pressbooks, its ID number, and theme. The error message itself includes several important pieces of information:

ERROR(RSC-020): The part in parenthesis refers to type of validation error produced by EPUBCheck. This particular error code is shown when the validator finds an invalid URL.

/srv/www/pressbooks.com/releases/20181205114740/web/app/uploads/sites/107381/pressbooks/exports/Test-Book-2-1544480239.epub/OEBPS/chapter-035-your-chapter.html: The bolded part of this string tells you which part of the EPUB file the validation error was found in. In this example, the message is telling us that the error occurred in chapter 35, which has been titled “Your Chapter.” If you saved a chapter before giving it a title, this URL will have the randomly generated slug instead of the chapter’s title.

(26,268): The last piece of data from this URL is the exact line and character the error occurs at in your EPUB file’s HTML. You can unzip your EPUB file and use a text editor (or Calibre) to open the file in question to inspect the exact location.

‘http://bit.ly/btb-v042″>http://bit.ly/btb-v042’ is not a valid URL: This part of the message gives us more information about the RSC-020 (invalid URL error). In this case, the error message has provided the offending text which should help you more quickly find and fix the problem in the relevant chapter.

Interpret PDF Validation Logs

PDF files tend to have fewer validation errors than ebook files. However, errors still sometimes occur. PDF validation logs will appear in your email inbox with the subject line: Pressbooks\Modules\Export\Prince\Pdf

Below is an example of what a PDF validation log may look like.

Array
(
[time] => Tue Sep 19 01:09:21 2017
[user] => tmcgrath
[site_url] => https://yourbooktitle.pressbooks.com
[blog_id] => 64631
[theme] => Adunis
[url] => http://yourbooktitle.pressbooks.com/format/xhtml?timestamp=1505783354&hashkey=d5f7474bad00cfde913572c9fe1caaa9&pb-latex-zoom=3&fullsize-images=1
)
Mon Sep 18 21:09:16 2017: —- begin
Mon Sep 18 21:09:20 2017: page 163: warning: no font for Emoticons character U+1F609, fallback to ‘?’
Mon Sep 18 21:09:21 2017: finished: success
Mon Sep 18 21:09:21 2017: —- end

The PDF validation log is straightforward; you’ll see the date stamps for the beginning, the flagged errors, the successful finish, and the end of the process. The only part you’ll need to look at is the error.

Find an error by looking for the word “warning”. Each warning will begin with a timestamp. Afterward, you’ll see a description of the error. For the example above, on page 163, the PDF converter was unable to find a font in the file that supplied the emoticon character entered by the user.

To solve an error like the one above, a user can find the page number from the error report, go to its chapter in Pressbooks, and remove the emoticon that caused the problem.

SASS Error Validation Logs

SASS errors report problems with your book’s CSS (cascading style sheet). SASS errors appear in your email inbox with the subject line: SASS Error 

Below is an example of what a SASS error may look like.

Array
(
[time] => Sun Dec  9 23:44:51 2018
[user] => mcgratay
[site_url] => https://yourbooktitle.pressbooks.com/wp
[blog_id] => 112926
[Exception] => Array
(
=> 0
  [error] => unclosed block: failed at `` (stdin) on line 49
[file] => /srv/www/pressbooks.com/releases/20181205114740/vendor/leafo/scssphp/src/Parser.php
[line] => 128
[trace] => #0 /srv/www/pressbooks.com/releases/20181205114740/vendor/leafo/scssphp/src/Parser.php(173): Leafo\ScssPhp\Parser->throwParseError('unclosed block')
#1 /srv/www/pressbooks.com/releases/20181205114740/vendor/leafo/scssphp/src/Compiler.php(197): Leafo\ScssPhp\Parser->parse('$chapter: 'Chap...')
#2 /srv/www/pressbooks.com/releases/20181205114740/web/app/plugins/pressbooks/inc/class-sass.php(183): Leafo\ScssPhp\Compiler->compile('$chapter: 'Chap...')
#3 /srv/www/pressbooks.com/releases/20181205114740/web/app/plugins/pressbooks/inc/class-styles.php(468): Pressbooks\Sass->compile('$chapter: 'Chap...', Array)
#4 /srv/www/pressbooks.com/releases/20181205114740/web/app/plugins/pressbooks/inc/modules/export/prince/class-pdf.php(245): Pressbooks\Styles->customize('prince', '\n\n@prince-pdf {...', '\n\n@prince-pdf {...')
#5 /srv/www/pressbooks.com/releases/20181205114740/web/app/plugins/pressbooks/inc/modules/export/prince/class-docraptor.php(55): Pressbooks\Modules\Export\Prince\Pdf->kneadCss()
#6 /srv/www/pressbooks.com/releases/20181205114740/web/app/plugins/pressbooks/inc/modules/export/class-export.php(744): Pressbooks\Modules\Export\Prince\Docraptor->convert()
#7 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-includes/class-wp-hook.php(286): Pressbooks\Modules\Export\Export::formSubmit('')
#8 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)
#9 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#10 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-settings.php(450): do_action('init')
#11 /srv/www/pressbooks.com/releases/20181205114740/web/wp-config.php(9): require_once('/srv/www/pressb...')
#12 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-load.php(42): require_once('/srv/www/pressb...')
#13 /srv/www/pressbooks.com/releases/20181205114740/web/wp/wp-admin/admin.php(31): require_once('/srv/www/pressb...')
#14 {main}
))

SASS errors are produced by malformed CSS and are typically triggered by something you've added using the Custom Styles feature. The important part of the SASS error is the information that comes after:

  [error] =>

In the example above, the error in the CSS is an "unclosed block." The error log states that the block has failed on line 49. You can go into your CSS, find line 49, and modify the CSS to resolve the error. With this error, the user forgot to add a closing bracket "}" to their custom styles. The W3C's CSS Validation tool can be very helpful in helping you figure out the source of errors in your custom CSS (and how to resolve them).

Need help?

For assistance with interpreting and fixing validation errors, contact Megan Dempsey, RVCC Pressbooks Network Administrator.

License

Icon for the Creative Commons Attribution 4.0 International License

RVCC Pressbooks User Guide Copyright © by Megan Dempsey is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book