CQLSearchService whith non-existing space

I’m using the CQLSearchService to find pages by title and space like this:

String cqlSearch = "title=\"" + title + "\" AND space=\"" + space + "\"";
PageResponse<Content> results = cqlSearchService.searchContent(cqlSearch, ExpansionsParser.parse("space, history"));

If the space does not exist, executing the search throws following exception:

Caused by: java.lang.IllegalArgumentException: parameters should not be empty

This is really confusing and illogical, and I don’t see the point why this doesn’t return an empty result, or, at least, say something like “The space Space could not be found”