It's still okay to have this check, even though it should also be in the parser. (The parser will have a better error message, with location in the query string.)