This also seems to return -1 as an error case. We should document when this occurs.