[BUG] [claude-code] AST parser raises "Unhandled node type: string" on for-loops with multiple long path arguments

Resolved 💬 3 comments Opened May 1, 2026 by jmpego Closed May 5, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Summary

The Bash AST parser in Claude Code (v2.1.126, observed 2026-05-01)
emits the rejection Unhandled node type: string on for f in <path1>
<path2> <pathN>; do ... done
constructions where the path arguments
are absolute paths containing hyphens, dots, and UUID-style segments.

Standard Bash parses these as bare words; the AST parser appears to
classify them as string literals it does not know how to handle.

What Should Happen?

Expected: command runs (or is allowed under prefix rule).
Actual: parser emits Unhandled node type: string and falls back to
interactive approval.

Error Messages/Logs

Steps to Reproduce

for f in /Users/me/.claude/projects/-Users-me-Enterprise/4902bdde-adff-4936-8ab7-63cb9bcb5d21.jsonl \
         /Users/me/.claude/projects/-Users-me-Enterprise/6a65a958-6a88-43eb-9dd1-6cb93e76be53.jsonl; do
  echo "$f"
  ls -la "$f" 2>/dev/null
done

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.126 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

Workaround

printf '%s\n' /path/A /path/B | while read -r f; do ... done

This passes the parser cleanly, suggesting the issue is specific to
the for ... in <list> grammar branch with long hyphenated path
arguments rather than to bare-word iteration in general.

Impact

Low. The fall-back is interactive approval, so no security impact.
But it adds friction for legitimate batch operations on session
files (a common pattern in Claude Code itself).

Environment

  • Claude Code v2.1.126
  • macOS 25.4.0 (Darwin), Apple Silicon
  • Reproduces with stock zsh and bash 5.2 wrappers

View original on GitHub ↗

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