BUG: fix uninitialized-use on invalid sort kind

orign is unset at that point but used in the fail goto,
can probably only be triggered by using the C-api wrong.