[BUG] Bun Bus error crash on macOS Silicon when pasting image (chat:imagePaste)
Status Fixed / completed
Reported on v2.1.87
Maintainer reply None cached
Activity 6 comments · opened Mar 31, 2026 · closed Apr 8, 2026
Description
Claude Code crashes with a Bun Bus error when using the chat:imagePaste action (pasting an image from clipboard). This is a hard runtime crash, not a silent failure — Bun panics and the entire session terminates.
Environment
- Claude Code version: 2.1.87
- Bun version (bundled): 1.3.11 (759ce802)
- OS: macOS 26.3 (Darwin 25.3.0)
- Platform: macOS Silicon (Apple M4 Pro)
- RAM: 48GB
Crash Details
Bus error at address 0xBAD4007
Bun v1.3.11 (759ce802) macOS Silicon
Args: "claude" "--dangerously-skip-permissions" "--verbose" "--dangerously-skip-permissions" "--verbose"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) abort_signal(16) fetch(14) jsc spawn(28) standalone_executable process_dlopen yaml_parse(222)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:buffer" "node:child_process" "node:constants" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:path/posix" "node:path/win32" "node:perf_hooks" "node:process" "node:stream" "node:stream/consumers" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:zlib" "ws" "node:http2"
Elapsed: 90411ms | User: 3431ms | Sys: 1046ms
RSS: 0.89GB | Peak: 0.89GB | Commit: 0.90GB | Faults: 72 | Machine: 51.54GB
panic(main thread): Bus error at address 0xBAD4007
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
Bun Crash Report Link
Steps to Reproduce
- Launch Claude Code on macOS Silicon:
claude --dangerously-skip-permissions --verbose - Use the
chat:imagePasteaction (Cmd+V with an image in clipboard) - Bun crashes with Bus error
Notes
- The crash happens early in the session (~90 seconds elapsed), so this is not a long-session memory issue
- The address
0xBAD4007looks like a sentinel/poison value, suggesting use-after-free or accessing freed memory during image buffer processing - Memory usage at crash was modest (0.89GB RSS)
- Related to #22632 (Bun crash during sessions) but with a specific, reproducible trigger (image paste) and different crash signature (Bus error vs segfault)
- Several open issues report image paste not working (#39761, #26901, #29776) but none report it causing a full Bun panic
Expected Behavior
Image paste should either work or fail gracefully with an error message, not crash the runtime.
6 Comments
Additional info from reporter
Cmd+V→chat:imagePasteaction)The keybinding in question (from
keybindings.jsonline 29):Full stack trace from Bun crash report
The reporter also submitted the crash via
bun.report. Stack trace confirms the crash is in a NAPI native binding during clipboard read:Root cause appears to be: A NAPI class constructor (
NapiClass_ConstructorFunction) is called with a bad pointer (0xBAD4007— a sentinel/poison value), suggesting the native clipboard module returns or accesses freed/invalid memory when reading image data from the macOS clipboard viaCmd+V.Note: This is in the bundled Bun standalone executable — updating system Bun has no effect. The fix needs to come from either:
It's what they get for using Bun/zig.
Root cause identified: Bun 1.3.11 NAPI crash — fixed in 1.3.12 canary
Summary
The crash is a Bun 1.3.11 bug in NAPI error handling, not a Claude Code bug. When
new ImageProcessor()throws an error, Bun 1.3.11 dereferences a poison pointer (0xBAD4007) and panics instead of propagating the JS exception. Bun 1.3.12 canary already fixes this — the same code returns a normal error with no crash.The regression was exposed by v2.1.83 (March 25), which changed native module loading from eager (at startup) to lazy (on first use). This moved the
ImageProcessorconstruction from startup — where errors were handled — to the Ctrl+V code path, where the Bun panic kills the process.Reproduction (standalone, no Claude Code needed)
image-processor.nodefrom the Claude standalone binary (it's an embedded Mach-O dylib in the__BUNsegment at offset0xb8111eb, 1652KB, links against AppKit/CoreGraphics/ImageIO)Fix
Claude Code needs to update its bundled Bun from 1.3.11 to 1.3.12+. The NAPI crash fix is already in the 1.3.12 canary. Once the error is thrown as a JS exception instead of a Bus error, Claude's existing fallback code path should handle it and image paste should work normally.
Environment
Timeline
| Date | Event |
|------|-------|
| Mar 25 | v2.1.83 released — native module loading changed from eager to lazy |
| ~Mar 25-29 | Image paste crash begins |
| Mar 29 | v2.1.87 — version in original bug report |
| Apr 8 | Confirmed still crashes on v2.1.96; root cause identified and fix verified on Bun 1.3.12 canary |
Fixed in https://github.com/anthropics/claude-code/releases/tag/v2.1.97
Probably with:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.