A 311 parser gets confident but malformed ticket JSON from Claude. What defensive handling fits?
Select an answer to reveal the explanation.
Short Explanation
Confidence isn't validity—if the ticket JSON is broken, treat it as a fail and retry with repair instructions.
Full Explanation
Treating confident but malformed ticket JSON as failure and retrying with repair instructions is defensive handling for 311 parsers. That approach works because fluency and confidence cues are not schema validity; broken tickets still break work-order routing, SLA clocks, and GIS assignment. A controlled retry with repair instructions gives Claude a chance to fix structure without pretending the first bad payload was acceptable for municipal queues.
Resending the same ticket prompt verbatim with a higher max token limit fails conceptually because repeating the prompt does not fix invalid structure; more tokens cannot substitute for required fields and types, and the model may simply repeat or extend the malformed JSON. Coercing the malformed ticket in application code by filling missing fields with default values fails because defaults are guesses about a resident's request, not schema validity—a missing required field can still be wrong or incomplete, so silently patching it gives the parser a false reason to treat the ticket as fixed. Parsing the malformed ticket with a lenient JSON parser and inferring missing brackets and commas fails because downstream systems inherit corruption and create false work or silent drops; inferred syntax can look valid while still misrouting or misrepresenting the 311 request.
Exam caveat: unbounded retries can amplify cost and latency; repair loops need caps, backoff, and escalation to a human queue after N failures. Operational check: validate ticket JSON on every Claude response, on failure re-prompt with the schema errors, cap retries, meter tokens, and open a 311 exception ticket when repair still fails so residents are not left without a work order.