Skip to content

pi crashes on startup with MSYS2 ucrt64 Node.js #5028

@Aqwyh123

Description

@Aqwyh123

What happened?

pi immediately crashes on startup with an uncatchable Rust panic when the @mariozechner/clipboard native addon is loaded. Windows clipboard (clip) fallback exists but never gets reached because the abort happens at module import time.

thread '<unnamed>' panicked at napi-sys-2.4.0\src\functions.rs:7:3:
Node-API symbol has not been loaded
thread caused non-unwinding panic. aborting.

The crash occurs in napi_register_module_v1 (compiled with panic = abort), so try-catch cannot intercept it.
Root cause: @mariozechner/clipboard was compiled with napi-sys 2.4.0, which on Windows loads N-API symbols from the host process via GetProcAddress. When Node.js is the MSYS2 ucrt64 build, the N-API symbols are not exported in a way MSVC-built .node files can resolve.
napi-rs has since fixed this upstream (napi-sys v3.1.0+) by switching to libloading for dynamic symbol resolution, but @mariozechner/clipboard has not been rebuilt with the fix.

Steps to reproduce

  1. Install MSYS2 ucrt64 environment and its nodejs package
  2. npm install -g --ignore-scripts @earendil-works/pi-coding-agent
  3. pi --version

Expected behavior

pi should start without crashing. Clipboard can fall back to the existing platform-specific tools (clip on Windows) which are already implemented in clipboard.js.

Version

0.75.5

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions