claude-code - 💡(How to fix) Fix AskUserQuestion: validation errors silently discard user-entered free-text answers and notes [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56170Fetched 2026-05-05 05:56:22
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

When the AskUserQuestion tool returns an InputValidationError (for example, schema mismatch on the answers field shape), every value the user typed into the form — selected options, "Other" free text, and any per-question notes — is discarded. The user's input is not echoed back to the assistant, not preserved in any retry buffer, and not surfaced in the error message. The user must retype everything from scratch with no recall aid.

Error Message

When the AskUserQuestion tool returns an InputValidationError (for example, schema mismatch on the answers field shape), every value the user typed into the form — selected options, "Other" free text, and any per-question notes — is discarded. The user's input is not echoed back to the assistant, not preserved in any retry buffer, and not surfaced in the error message. The user must retype everything from scratch with no recall aid. 2. Acceptable: on validation error, the harness should preserve the form payload locally and re-render the form with the prior values pre-populated, so the user does not have to retype. 3. Minimum: the form UI should warn the user that retries are destructive and offer "copy my answers to clipboard" before submission. AskUserQuestion is one of the few mechanisms by which a Claude Code session captures durable user intent mid-task. When that intent is destroyed by a tool-side validation bug, the user must reconstruct it from memory, often in the middle of a long-running multi-agent operation. The cost is asymmetric: the assistant simply retries, but the user pays in rewritten context and lost trust. In one observed session, a user typed several paragraphs of custom routing instructions into "Other" fields; all were lost on a single validation error, and the user had no way to recover them.

  • Wrap AskUserQuestion form submission in a try/validate/serialize layer that persists the raw form payload to the conversation transcript before the schema check runs. On validation failure, hand that payload back to the assistant as part of the error so the assistant can reflect it to the user verbatim.

Root Cause

When the AskUserQuestion tool returns an InputValidationError (for example, schema mismatch on the answers field shape), every value the user typed into the form — selected options, "Other" free text, and any per-question notes — is discarded. The user's input is not echoed back to the assistant, not preserved in any retry buffer, and not surfaced in the error message. The user must retype everything from scratch with no recall aid.

RAW_BUFFERClick to expand / collapse

Summary

When the AskUserQuestion tool returns an InputValidationError (for example, schema mismatch on the answers field shape), every value the user typed into the form — selected options, "Other" free text, and any per-question notes — is discarded. The user's input is not echoed back to the assistant, not preserved in any retry buffer, and not surfaced in the error message. The user must retype everything from scratch with no recall aid.

Reproduction

  1. In a Claude Code session, ask the assistant to use AskUserQuestion with multiSelect: true for one or more questions.
  2. The user fills out the form, including selections plus extra context typed into "Other" or notes fields, and submits.
  3. The tool call fails with an InputValidationError (in the observed case, due to the harness expecting answers.<question> as a string but the multiSelect flow producing an array).
  4. The assistant retries AskUserQuestion with a corrected schema. The form re-renders blank — none of the user's prior answers or free text are preserved.

Actual Behavior

  • All user-entered text is lost.
  • The assistant has no way to recover it (it never reached the assistant — it died inside the tool boundary).
  • The user has no warning before submitting that their input is at risk.
  • This is especially painful when the user has typed substantial custom context into the "Other" field for one or more questions.

Expected Behavior

One of the following, in order of preference:

  1. Best: validation errors should still pass the user's typed values back to the assistant, so the assistant can re-prompt with the prior answers pre-filled or at minimum can paraphrase them in a confirmation message.
  2. Acceptable: on validation error, the harness should preserve the form payload locally and re-render the form with the prior values pre-populated, so the user does not have to retype.
  3. Minimum: the form UI should warn the user that retries are destructive and offer "copy my answers to clipboard" before submission.

Why It Matters

AskUserQuestion is one of the few mechanisms by which a Claude Code session captures durable user intent mid-task. When that intent is destroyed by a tool-side validation bug, the user must reconstruct it from memory, often in the middle of a long-running multi-agent operation. The cost is asymmetric: the assistant simply retries, but the user pays in rewritten context and lost trust. In one observed session, a user typed several paragraphs of custom routing instructions into "Other" fields; all were lost on a single validation error, and the user had no way to recover them.

Proposed Fix Direction

  • Wrap AskUserQuestion form submission in a try/validate/serialize layer that persists the raw form payload to the conversation transcript before the schema check runs. On validation failure, hand that payload back to the assistant as part of the error so the assistant can reflect it to the user verbatim.
  • Alternatively, treat multiSelect answers as a documented array type at the schema level so the originating bug class disappears. The transcript-preservation fix is still warranted regardless, since user-typed "Other" text is a more general loss vector.

Severity

P1 — silently destroys user input. Not a crash, but a trust-eroding data loss bug.

extent analysis

TL;DR

To prevent loss of user input on validation errors, wrap AskUserQuestion form submission in a try/validate/serialize layer that persists the raw form payload to the conversation transcript before the schema check runs.

Guidance

  • Implement a try/validate/serialize layer around AskUserQuestion form submission to catch and preserve user input before schema validation.
  • Consider treating multiSelect answers as a documented array type at the schema level to prevent validation errors due to type mismatches.
  • On validation failure, hand the preserved payload back to the assistant as part of the error so it can be reflected to the user.
  • Alternatively, add a "copy my answers to clipboard" feature to the form UI to allow users to recover their input in case of validation errors.

Example

// Pseudo-code example of wrapping AskUserQuestion form submission
try {
  const userInput = await AskUserQuestion(formData);
  // Validate and serialize userInput
} catch (validationError) {
  // Preserve userInput in conversation transcript
  conversationTranscript.push(userInput);
  // Hand preserved userInput back to assistant as part of error
  throw new Error(`Validation error: ${validationError.message}`, userInput);
}

Notes

The proposed fix direction requires modifications to the AskUserQuestion tool and its interaction with the conversation transcript. The severity of the issue warrants a prompt fix to prevent further data loss and erosion of user trust.

Recommendation

Apply the workaround by implementing the try/validate/serialize layer around AskUserQuestion form submission to preserve user input on validation errors. This approach addresses the immediate issue and provides a foundation for further improvements, such as treating multiSelect answers as a documented array type.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix AskUserQuestion: validation errors silently discard user-entered free-text answers and notes [1 comments, 2 participants]