better error handling and logging for invalid jobs