Multiple TypeError crashes: undefined is not an object (R.map and T.match) in result rendering
Status Closed — not planned
Maintainer reply None cached
Activity 6 comments · opened Dec 19, 2025 · closed Mar 8, 2026
Description
Claude Code crashes with multiple "undefined is not an object" errors when rendering tool results. Two related issues observed:
undefined is not an object (evaluating 'R.map')- in Grep result renderingundefined is not an object (evaluating 'T.match')- in Bash result rendering
Environment
- Claude Code Version: 2.0.72
- OS: macOS (Darwin 25.1.0) - arm64
- Node.js: v25.2.1
- Bun: 1.3.3
---
Bug 1: R.map error
Error Message
ERROR undefined is not an object (evaluating 'R.map')
Stack Trace
- ya_ (/$bunfs/root/claude:1161:1824)
- wbB (/$bunfs/root/claude:2568:3944)
- uq (/$bunfs/root/claude:173:20697)
...
Steps to Reproduce
User asked about FastAPI routing behavior, Claude performed internal Grep search.
---
Bug 2: T.match error
Error Message
ERROR undefined is not an object (evaluating 'T.match')
Stack Trace
/$bunfs/root/claude:2587:12862
Steps to Reproduce
curl -s http://localhost:1907/random-prefix/api/v1/health 2>&1 | head -20
Response was:
{"detail": "Not Found"}
The error occurred when Claude tried to render the Bash tool result.
---
Root Cause Analysis
Both errors appear to be missing null checks before calling methods on potentially undefined variables:
- Bug 1:
filenamesparameter (R) is undefined when.map()is called - Bug 2: Some text parameter (
T) is undefined when.match()is called
The rendering functions assume these values always exist, but they can be undefined in certain edge cases.
Suggested Fix
Add defensive null checks:
// Bug 1
let C = (R || []).map((q) => q).join(`\n`);
// Bug 2
if (!T) return { cleanedStderr: "" };
let R = T.match(pattern);
Additional Context
- Running multiple Claude Code instances simultaneously
- Errors occur intermittently during tool result rendering
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗