postgres could not execute your query due to a syntax error. is there no further text available? usually “ERROR: … ^” points to the location of the query which is causing the error, e.g.
... WHERE whatever NOT IN (...) AND whatever != '' .... ORDER BY ...
Additional Information: ERROR: syntax error at or near "" LINE 10: . ^