Better error message when list cannot be cast