throw an exception if the type is not byte_array (for all 3)