Weird TopLink exception message

Got a strange exception today during executing a dynamic JPA query via TopLink.
It looks like:

Caused by: line 1:25: unexpected token: null
at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.rangeVariableDeclaration(EJBQLParser.java:1727)
… 136 more

Initially the query looks like “select o from Test”. It’s definitely not correct because it should be “select o from Test o”. But in any case the message is not useful at all.