Throw an error if mode cannot be determined rather than reporting cryptic error.