Rescue Errno::EBADF on sha1_checksum generation