React Error #31 when using tab autocomplete (v2.1.7, macOS)
Description
When using tab to autocomplete a partially typed command, Claude Code crashes with a React Error #31 (Objects are not valid as a React child).
Environment
- Claude Code Version: 2.1.7
- Model: Opus 4.5
- OS: macOS (Darwin 24.6.0)
- Platform: darwin
Steps to Reproduce
- Start Claude Code CLI
- Begin typing a command (partial input)
- Press Tab to trigger autocomplete
- Error occurs
Error Output
ERROR Minified React error #31; visit https://react.dev/errors/31?args[]=object%20with%20keys%20%7Boptional%7D for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
The decoded error message indicates: "Objects are not valid as a React child (found: object with keys {optional})"
Stack Trace (sanitized)
- f0 (/$bunfs/root/claude:682:8726)
- N_ (/$bunfs/root/claude:682:10833)
- xq (/$bunfs/root/claude:682:12401)
- Tw (/$bunfs/root/claude:682:14688)
- <anonymous> (/$bunfs/root/claude:682:15201)
- SC (/$bunfs/root/claude:682:35543)
- o5 (/$bunfs/root/claude:682:51691)
- QG (/$bunfs/root/claude:682:85841)
- Wv (/$bunfs/root/claude:682:84821)
- Mf (/$bunfs/root/claude:682:84646)
Analysis
The error suggests that somewhere in the React UI rendering (likely the autocomplete/suggestion component), an object with keys {optional} is being passed directly as a React child instead of being properly stringified or rendered as a component.
This appears to be in the CLI's bundled React code (/$bunfs/root/claude), not user code.
Additional Context
The error causes the CLI to crash and requires restarting. The issue is reproducible by using tab completion on partial command input.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗