We should probably add this type of check to all our APIs which fundamentally must operate on bytes.