TUI: Windows CLI won't start due to Bun GC error
Before opening, please confirm:
- [x] I have searched for duplicate or closed issues
Operating System
Windows 11 10.0.2620
Kiro Version
2.4.1
Bug Description
Upon launching from windows powershell the following error:
FATAL ERROR: Finalizer is calling a function that may affect GC state.
The finalizers are run directly from GC and must not affect GC state. clipboard
Use `node_api_post_finalizer` from inside of the finalizer to work around this issue.
It schedules the call as a new task in the event loop.
============================================================
Bun v1.3.13 (bf2e2cec) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "C:\Users\fwatling\AppData\Local\kiro-cli\bun" "C:\Users\fwatling\AppData\Local\kiro-cli\tui.js" "chat" "--trust-all-tools" "--model" "claude-opus-4.7" "update"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) fetch jsc spawn(3) process_dlopen
Builtins: "bun:main" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:module" "node:net" "node:os" "node:path" "node:process" "node:tty" "node:util"
Elapsed: 2311ms | User: 406ms | Sys: 1156ms
RSS: 0.28GB | Peak: 0.28GB | Commit: 0.48GB | Faults: 70357 | Machine: 68.14GB
panic(main thread): napi_reference_unref
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.3.13/wa1bf2e2ceigEugogCw71huBCUkoffi.nodeysrFCUkoffi.nodewt3Tuts9oCu5oguBs809wCgu5snCwgov8Bm3+m8B8m+m8BsgivwCy0gvwCopgrL4j9zJos/5G2p15qBq6++Fsrz/F48u/Fml2nGA0eNrLSyzIjC9KTUstSs1LTo0vzStKTQMAVhgINg
Steps to Reproduce
- Open Kiro using kiro-cli from powershell
- See the error as above
Expected Behavior
Kiro opens without an error from Bun
Workaround
--legacy-ui works as normal
Conversation ID
No response
Additional Context
No response
I should also note, this is not fixed after updating Bun -
bun upgrade Congrats! You're already on the latest version of Bun (which is v1.3.14)
Workaround as pointed out in https://github.com/kirodotdev/Kiro/issues/8879: --legacy-ui works as normal
🤖 Potential Duplicate Detected
This issue appears to be similar to:
- #7202: kiro-cli 1.29.4, --tui mode crashes silently with SIGTRAP on macOS 15.7.5 arm64 (85% similar)
- #6902: TUI: won't start, no error message - AVX2 required for bun (85% similar)
What happens next?
- ⏰ This issue will be automatically closed in 3 days
- 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
- 💬 Comment on the original issue if you have additional information
Why is this marked as duplicate? Both report kiro-cli TUI mode crashes with similar fatal errors and crash patterns, though on different operating systems (Windows vs macOS)
This is not a duplicate, I get the exact same error.
Thank you for your feedback! 🙏
The duplicate label has been removed and this issue has been sent back for maintainer review.
A maintainer will review this issue shortly.
The issue seems to be fixed in Bun v1.3.14. Perhaps Kiro CLI is pinned to v1.3.13.
Additional confirmation from another Windows 11 setup. This looks like the same TUI-only crash.
Environment checked locally:
- Kiro CLI: kiro-cli-chat 2.4.1
- Diagnostic hash: a214db46d294d9f45269d95936a5d72e3f61c232
- Diagnostic date: 2026-05-21T02:42:32.739319Z
- OS: Windows 11 Enterprise build 26200
- Kiro bundled runtime in crash report: Bun v1.3.13 (bf2e2cec) Windows x64
- Kiro install path uses bundled runtime under %LOCALAPPDATA%\kiro-cli, so updating system Bun does not affect this.
kiro-cli update --checkreports current version 2.4.1.kiro-cli settings list --format json-prettyreturns{}.
Repro/control:
kiro-cli.exe chat --legacy-uidoes not crash.kiro-cli.exe chat --tui --agent-engine v2crashes.- Running
chat --tuiwithout forcing v2 can also hit a separate option conflict if the default engine is v1, but forcing v2 still crashes.
Crash signature:
FATAL ERROR: Finalizer is calling a function that may affect GC state.Use node_api_post_finalizer from inside of the finalizer to work around this issue.panic(main thread): napi_reference_unref- Feature list includes
process_dlopen; crash report referenceskoffi.node.
Bun crash report from this machine: https://bun.report/1.3.13/wa1bf2e2ceigEugsgCw71huBCUkoffi.nodeysrFCUkoffi.nodewt3Tuts9oCu5oguBs809wCgu5snCwgov8Bm3+m8B8m+m8BsgivwCy0gvwC8ru2Vwr2hUs9iqxBst6kxBok9zJos/5G2p15qBq6++FA0eNrLSyzIjC9KTUstSs1LTo0vzStKTQMAVhgINg
Likely related upstream Bun work:
- https://github.com/oven-sh/bun/issues/30286
- https://github.com/oven-sh/bun/pull/30291
Request: please rebuild the Kiro CLI Windows bundle with a Bun runtime containing the N-API finalizer fix, or make legacy UI the automatic fallback for affected Windows TUI launches.
I also noticed when using the Kiro-cli --legacy-ui mode I can't load any of the chats created using /kiro chat save on non-legacy cli. Unsure if this is intended.
I also noticed when using the Kiro-cli --legacy-ui mode I can't load any of the chats created using /kiro chat save on non-legacy cli. Unsure if this is intended.
Even better reason to get this issue addressed on the current UI mode.
can someone help in how to update bun to latest model, as my installed version is 1.3.13
@devamshah22 bun upgrade
@devamshah22 but if you're asking because of the error you get when trying to run kiro, that's because it's still using 1.3.13 (which is the issue)
@devamshah22 but if you're asking because of the error you get when trying to run kiro, that's because it's still using 1.3.13 (which is the issue)
Upgrading Bun won't do anything FYI. I think main issue is in 'tui.js'
The finalizers are run directly from GC and must not affect GC state. /copy to clipboard
Use `node_api_post_finalizer` from inside of the finalizer to work around this issue.
It schedules the call as a new task in the event loop.
============================================================
Bun v1.3.14 (0d9b296a) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "C:\Users\admin\AppData\Local\kiro-cli\bun" "C:\Users\admin\AppData\Local\kiro-cli\tui.js"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) fetch jsc spawn(3) process_dlopen
Builtins: "bun:main" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:module" "node:net" "node:os" "node:path" "node:process" "node:tty" "node:util"
Elapsed: 992ms | User: 218ms | Sys: 109ms
RSS: 0.15GB | Peak: 0.15GB | Commit: 0.38GB | Faults: 37892 | Machine: 17.10GB
panic(main thread): napi_reference_unref
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:```
I already run the "bun upgrade", and when i typed again:
bun upgrade
Congrats! You're already on the latest version of Bun (which is v1.3.14)
I then closed the console and start again the kiro-cli, which give me following:
kiro-cli
● Initializing...
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
~\dev\cbx\jira
FATAL ERROR: Finalizer is calling a function that may affect GC state.
The finalizers are run directly from GC and must not affect GC state. /copy to clipboard
Use `node_api_post_finalizer` from inside of the finalizer to work around this issue.
It schedules the call as a new task in the event loop.
============================================================
Bun v1.3.13 (bf2e2cec) Windows x64
Windows v.win11_dt
CPU: sse42 avx avx2
Args: "C:\Users\onionhead\AppData\Local\kiro-cli\bun" "C:\Users\onionhead\AppData\Local\kiro-cli\tui.js"
Features: Bun.stderr(2) Bun.stdin(2) Bun.stdout(2) fetch jsc spawn(3) process_dlopen
Builtins: "bun:main" "node:child_process" "node:crypto" "node:events" "node:fs" "node:fs/promises" "node:module" "node:net" "node:os" "node:path" "node:process" "node:tty" "node:util"
Elapsed: 817ms | User: 359ms | Sys: 46ms
RSS: 0.26GB | Peak: 0.26GB | Commit: 0.46GB | Faults: 64756 | Machine: 15.86GB
panic(main thread): napi_reference_unref
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:
https://bun.report/1.3.13/wa1bf2e2ceigEugogCw71huBCUkoffi.nodeysrFCUkoffi.nodewt3Tuts9oCu5oguBs809wCgu5snCwgov8Bm3+m8B8m+m8BsgivwCy0gvwCopgrL4j9zJos/5G2p15qBq6++Fsrz/F48u/Fml2nGA0eNrLSyzIjC9KTUstSs1LTo0vzStKTQMAVhgINg
@onionhead0708 As stated previously, that is not going to fix the issue with kiro.
The crash seems to be caused by the koffi native FFI library used.
In the enableWindowsVTInput() method of the terminal input handler class (iu). Inside the iu class (the terminal driver).
Koffi is a native Node.js addon that uses NAPI (N-API) to interface with kernel32.dll for enabling Windows Virtual Terminal input mode.
The error (napi_reference_unref panic during GC finalizers) happens because:
- koffi creates native NAPI references to track the FFI function pointers and loaded DLL handles.
- When Bun's garbage collector runs and finalizes these native objects, it calls napi_reference_unref from within a GC finalizer callback.
- Bun (v1.3.14) doesn't support calling NAPI reference manipulation functions from inside GC finalizers, which is what triggers the panic.
Since it's a bundled file, we can't do anything to fix it (that I know of).
So no, updating Bun won't fix, And it's not due to Kiro CLI not pinning the Bun version like I first thought.
Hi @FinWatling, thank you for the detailed report and the workaround. We've confirmed this is a crash in the koffi native module when Bun's garbage collector runs — it affects Windows users on kiro-cli 2.4.1.
Root cause: The TUI uses koffi to call Windows kernel32 APIs for VT input support. When koffi's native objects are garbage collected, the destructor violates Bun's NAPI finalizer rules, causing the panic.
Workaround: kiro-cli --legacy-ui
We're working on a resolution. Thanks for also noting the saved chat incompatibility with legacy-ui — we'll track that separately.
My pleasure, @AnilMaktala. Thanks for the quick response 👍🏼
any ETA when the fix will be?
Same issue here on Dell Latitude 7450, Intel Core Ultra 7 165U, 32GB RAM, Windows 11 Enterprise (Build 10.0.26200), Kiro CLI 2.4.1.
Workarounds that work:
kiro-cli --legacy-ui(interactive, no TUI)kiro-cli chat --no-interactive --trust-all-tools "prompt"(headless mode — great for CI/CD and automation scripts)
What does NOT work:
kiro-cli(default TUI — crashes)kiro-cli chat --trust-all-tools(interactive TUI — crashes)- Updating Bun to 1.3.14 (confirmed by FinWatling above)
Headless mode is fully functional for scripted/automated workflows. The crash only affects the interactive TUI.
The issue seems to be fixed in Bun v1.3.14. Perhaps Kiro CLI is pinned to v1.3.13.
Can confirm. Bun hash check resets to pinned version on init. Local fix breaks digital signature