error handling for invalid IDs