claude-code - 💡(How to fix) Fix Bash tool approval dialog: 'Unhandled node type: string' from tree-sitter bash renderer [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#48717Fetched 2026-04-16 06:52:58
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

When the Bash tool approval dialog renders a bash command containing certain syntax patterns, the tree-sitter bash syntax highlighter throws Unhandled node type: string. The error appears inline in the approval UI, requiring the user to acknowledge it before the command can proceed.

Error Message

When the Bash tool approval dialog renders a bash command containing certain syntax patterns, the tree-sitter bash syntax highlighter throws Unhandled node type: string. The error appears inline in the approval UI, requiring the user to acknowledge it before the command can proceed. The approval dialog renders the bash command with syntax highlighting (or no highlighting) without surfacing an error to the user. The dialog shows Unhandled node type: string as an error message that the user must acknowledge, creating repeated interruptions. Every time an agent runs a push-verify command pattern like the above, the user is prompted to address the error. In workflows where push verification runs frequently, this becomes persistent noise.

Root Cause

When the Bash tool approval dialog renders a bash command containing certain syntax patterns, the tree-sitter bash syntax highlighter throws Unhandled node type: string. The error appears inline in the approval UI, requiring the user to acknowledge it before the command can proceed.

Fix Action

Fix / Workaround

  • The command still executes correctly — this is a rendering-only bug
  • Likely the tree-sitter-bash grammar does not handle the string AST node in all positions
  • Workaround: use simpler bash commands that avoid the triggering syntax patterns

Code Example

LOCAL=$(git rev-parse HEAD) && \
REMOTE=$(gh api repos/owner/repo/git/refs/heads/$(git branch --show-current) --jq '.object.sha') && \
[ "$LOCAL" = "$REMOTE" ] && echo "✓ verified" || echo "✗ PUSH FAILED — do not proceed"
RAW_BUFFERClick to expand / collapse

Summary

When the Bash tool approval dialog renders a bash command containing certain syntax patterns, the tree-sitter bash syntax highlighter throws Unhandled node type: string. The error appears inline in the approval UI, requiring the user to acknowledge it before the command can proceed.

Reproduction

Run a bash command that includes one or more of these patterns in the approval dialog:

  • Single-quoted strings as command arguments (e.g. --jq '.object.sha')
  • Unicode characters in double-quoted strings (e.g. echo "✓ verified" or echo "✗ PUSH FAILED")
  • Long multi-line commands chained with && and backslash continuation

Example command that reliably triggers it:

LOCAL=$(git rev-parse HEAD) && \
REMOTE=$(gh api repos/owner/repo/git/refs/heads/$(git branch --show-current) --jq '.object.sha') && \
[ "$LOCAL" = "$REMOTE" ] && echo "✓ verified" || echo "✗ PUSH FAILED — do not proceed"

Expected behavior

The approval dialog renders the bash command with syntax highlighting (or no highlighting) without surfacing an error to the user.

Actual behavior

The dialog shows Unhandled node type: string as an error message that the user must acknowledge, creating repeated interruptions.

Impact

Every time an agent runs a push-verify command pattern like the above, the user is prompted to address the error. In workflows where push verification runs frequently, this becomes persistent noise.

Notes

  • The command still executes correctly — this is a rendering-only bug
  • Likely the tree-sitter-bash grammar does not handle the string AST node in all positions
  • Workaround: use simpler bash commands that avoid the triggering syntax patterns

Environment

  • Platform: macOS (darwin 25.4.0)
  • Claude Code CLI

extent analysis

TL;DR

The issue can be mitigated by simplifying bash commands to avoid certain syntax patterns that trigger the Unhandled node type: string error in the tree-sitter bash syntax highlighter.

Guidance

  • Identify and simplify bash commands that include single-quoted strings as command arguments, Unicode characters in double-quoted strings, or long multi-line commands chained with && and backslash continuation.
  • Test commands without these patterns to verify if the error is resolved.
  • Consider breaking down long commands into shorter, simpler ones to avoid triggering the error.
  • If possible, avoid using Unicode characters in double-quoted strings or replace them with their ASCII equivalents.

Example

No code snippet is provided as the issue is related to the tree-sitter bash syntax highlighter and not a specific code error.

Notes

The provided workaround may not be feasible for all use cases, especially where complex bash commands are necessary. The root cause of the issue seems to be related to the tree-sitter-bash grammar not handling the string AST node in all positions.

Recommendation

Apply workaround: Simplify bash commands to avoid triggering syntax patterns, as this is a rendering-only bug and does not affect command execution. This approach can help mitigate the issue until a more permanent fix is available.

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…

FAQ

Expected behavior

The approval dialog renders the bash command with syntax highlighting (or no highlighting) without surfacing an error to the user.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING