return error message in case of invalid format