[libcontacts] Avoid requests with invalid IDs