Repository navigation
Closed
Labels
crashAn issue that could cause a crashAn issue that could cause a crashmacOSAn issue that occurs on macOSAn issue that occurs on macOSneeds triageruntime
Description
How can we reproduce the crash?
Hi,
Bun.secrets crashes with a segmentation fault when called from within an AsyncLocalStorage context.
The following is my environment:
Bun v1.3.2 - b131639
macOS v15.6.1
And the following is a minimal reproduction.
import { AsyncLocalStorage } from "async_hooks"
const storage = new AsyncLocalStorage<{ context: string }>()
await storage.run({ context: "test" }, async () => {
await Bun.secrets.set({
service: "test-service",
name: "test-account",
value: "test-data",
})
})
Note
- Bun.secrets works fine when called outside AsyncLocalStorage
- This blocks OAuth flows that need to save credentials within async context managers
Relevant log output
bun minimal-crash-test.ts
============================================================
Bun v1.3.2 (b131639c) macOS Silicon
macOS v15.6.1
CPU: fp aes crc32 atomics
Args: "bun" "minimal-crash-test.ts"
Features: Bun.stderr(2) Bun.stdout(2) bunfig jsc transpiler_cache(9) tsconfig(4) tsconfig_paths(3)
Builtins: "bun:main" "node:assert" "node:async_hooks" "node:fs" "node:module" "node:os" "node:path" "node:tty" "node:util"
Elapsed: 287ms | User: 99ms | Sys: 55ms
RSS: 88.03MB | Peak: 88.03MB | Commit: 1.07GB | Faults: 1510 | Machine: 25.77GB
panic(main thread): Segmentation fault at address 0x1A
oh no: Bun has crashed. This indicates a bug in Bun, not your code.Stack Trace (bun.report)
Bun v1.3.2 (b131639) on macos aarch64 [AutoCommand]
Segmentation fault at address 0x0000001A
- 1 unknown/js code
jsc_llint_opEnterDone_LowLevelInterpreter64_asm_819- 1 unknown/js code
llint_call_javascriptInterpreter.cpp:1385:JSC::Interpreter::executeCallJSMicrotask.cpp:67:JSC::runJSMicrotaskVM.cpp:1352:JSC::VM::drainMicrotasksBunProcess.cpp:3435:Bun::jsFunctionDrainMicrotaskQueue- 1 unknown/js code
jsc_llint_commonCallOp__llintOpWithMetadata__llintOpWithReturn__llintOp__commonOp__fn__fn__makeReturn__fn__fn__fn__684_callHelper__dispatch_LowLevelInterpreter64_asm_2527llint_call_javascriptInterpreter.cpp:1385:JSC::Interpreter::executeCallCallData.cpp:69:JSC::callJSNextTickQueue.cpp:96:Bun::JSNextTickQueue::drainZigGlobalObject.cpp:2820:JSC__JSGlobalObject__drainMicrotasksevent_loop.zig:131:bun.js.event_loop.Task.tickQueueWithCountevent_loop.zig:217:bun.js.event_loop.tickevent_loop.zig:529:bun.js.event_loop.waitForPromiseVirtualMachine.zig:920:bun.js.jsc.OpaqueWrap.callbackbindings.cpp:4617:JSC__VM__holdAPILock
Features: transpiler_cache, tsconfig, tsconfig_paths, Bun.stderr, Bun.stdout, bunfig, jsc
Metadata
Metadata
Assignees
Labels
crashAn issue that could cause a crashAn issue that could cause a crashmacOSAn issue that occurs on macOSAn issue that occurs on macOSneeds triageruntime
Activity
github-actions commentedon Nov 14, 2025
Thank you for reporting this crash.
For Bun's internal tracking, this issue is BUN-121G.
github-actions commentedon Nov 14, 2025
Found 3 possible duplicate issues:
Bun.servecrash with request context run in AsyncLocalStorage #10846This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
monostop commentedon Nov 14, 2025
It seems related to #10846 still occurring (at least on macOS). This crash happens only when executing Bun.secrets.set inside AsyncLocalStorage context.
Fixes #24711
Fixes oven-sh#24711 (oven-sh#24982)