I get ORA-00904 / ORA-00936 exception in certain situations when SELECT statement uses XMLTABLES operator and the result set contains XMLTYPE columns. The same query works fine in SQL Plus.
I can send you the sample XML files and the queries which produce errors.