Claude Certified Architect – Foundations Practice Question 71: Refusal Stop Reason
Claude Certified Architect, Foundations · Test 8 · question 1 of 10
An agent loop runs on a current Claude model through the Messages API. On one iteration the response comes back as a normal HTTP 200 with an empty content array, stop_reason set to "refusal", and a stop_details object naming a policy category. The loop currently treats any stop_reason other than tool_use as a finished turn and returns the (empty) text to the user. How should the loop handle this response?
Show answer and explanation
Answer:
A refusal is a classifier decision returned as a successful response, not an error. The documented handling is to read stop_details (its category explains the policy area) and, because a declined request can usually be served by a different Claude model, retry it on a fallback model. The API also offers a server-side fallbacks option in beta, and SDK middleware for client-side retries. If no fallback serves it, the user should get an honest explanation.
- A is wrong: the refused turn has no content to continue from, and the same model will keep declining. - B is wrong: backoff fixes capacity problems (429, 529); a refusal is deterministic for that model and not a transient fault. - C is wrong: it hides a distinct stop reason, discards the category that tells you why, and gives the user nothing actionable.
Reference: Refusals and fallback