Would it be reasonable to make db_map throw an error if you try to look up a query that doesn't exist? Actually it boils down to being the proc db_qd_internal_get_cache that wil throw the error. I've made the change and it seems to work fine.
It certainly helps development work if OpenACS tells you when you've misspelled a query or moved a query from one proc to another and forgot to update the proc name in the xql file. Silent failures is one of the very worst sins of programming IMHO.