[BUG] AskUserQuestion returns 'undefined is not an object (evaluating H.map)' on subsequent calls within same turn (2.1.122)

Resolved 💬 2 comments Opened Apr 29, 2026 by g-taki Closed May 31, 2026

Summary

In 2.1.122, the second and subsequent AskUserQuestion calls within the same prompt turn return a tool error to the model instead of the user's answers. The first call works; every later call fails with:

undefined is not an object (evaluating 'H.map')

The questionnaire UI does render and the user answers it normally — but the answer never reaches the model. The tool result body contains is_error: true with the message above. Reducing the number of questions on retry (3 → 2 → 1) does not recover.

Environment

  • Claude Code: 2.1.122
  • OS: macOS Darwin 25.4.0 (arm64)
  • Model: claude-opus-4-7 (Opus 4.7, 1M context)
  • Install: native installer
  • No agent-teams flag set for this session, no plan mode
  • Caller: direct (main thread, not subagent)

Reproduction

Within a single turn (same promptId), call AskUserQuestion more than once.

Observed timeline from session JSONL (d5633776-c785-47bb-ad84-08b0091c9c01.jsonl, all 2026-04-29 UTC):

| # | Time (UTC) | Questions | multiSelect | Result |
|---|-----------|-----------|-------------|--------|
| 1 | 02:06:18 | 1 | false | ✅ User answered, normal tool_result returned |
| 2 | 02:07:26 | 3 | false / false / true | ❌ H.map TypeError |
| 3 | 02:08:31 | 2 | false / false | ❌ H.map TypeError |
| 4 | 02:08:46 | 1 | false | ❌ H.map TypeError |

All four calls share the same promptId (9f4f0b4c-5a19-4d76-a551-e2f1c2b08a76). Once the first failure occurs, every subsequent AskUserQuestion in that turn fails — even reducing to a single question with three short options does not recover. This suggests a per-turn state corruption rather than an input-shape problem.

The user reports that the questionnaire panel rendered correctly and they submitted an answer for each retry, so the failure is not on the user-input side.

Sample tool_result payload (failure)

{
  "type": "tool_result",
  "content": "undefined is not an object (evaluating 'H.map')",
  "is_error": true,
  "tool_use_id": "toolu_01FF64qrC525oBtXyaXFt6hb"
}

Possibly related (closed)

  • #49663 / #49865 — earlier AskUserQuestion regression in 2.1.111–2.1.112, fixed in 2.1.114. The minified function suspected there (xM6) called H.map(async q => …). The error string here uses the same identifier H.map, so this may be a separate code path with the same lurking pattern (calling .map on a possibly-undefined collection) re-emerging in a different flow — specifically the "second call within a turn" path.

Workaround

  • Restart the Claude Code session (process restart resets the corrupted per-turn state).
  • Tell the model to switch to free-text questions instead of AskUserQuestion for the rest of the turn.

Request

  • Please guard the H.map call site against undefined in the second-call / multi-call-per-turn path of AskUserQuestion.
  • Bonus: surface a more actionable error to the model so it can fall back to text rather than retrying the same broken tool call (here the model retried 3× before giving up, wasting tokens).

Thanks!

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗