Handle invalid_code separately