Throw exception if no id found and formatting