Expected next thing to be an escaping function, not $books.
<?php
if ( is_wp_error( $books ) ) { wp_die( $books ); }
?>
If you are absolutely sure that all of the data in the WP_Error object is escaped, you could just whitelist the call to wp_die() so that WPCS will ignore it, like this:
<?php
wp_die( $books );
// WPCS: xss ok.
?>