In our Jira 4.1.2 database there are a few issues that are invalid. (They're victims of Jira 3 Bulk Move bugs like
JRA-18453. After a move to another project their security level is still set to the old project and thus invalid. But I'm not filing on that bug as I believe that has been fixed in Jira 4. I'm just stating this as an example of how invalid issues still live in our Jira 4.1.2).
If a user runs a JQL function that returns JiraDataType.ISSUE and the function's results hit one of these invalid issues, they expect to get all their results. If there was an invalid issue, there should be perhaps a warning message that says, "Issue ACME-8242 is invalid," and the rest of the results are returned. Instead they get 0 results and an error message that says only, "A value provided by the function 'jqlFunction' is invalid for the field 'issue'.
I refer to this bug in a related JQL Improvement request,