⚠️ [BUG]: "ProxyAgent" CRASH ON Node 24 (UND_ERR_INVALID_ARG) && REQUEST FOR VERBOSE LOGGING FLAG
I attempted to initialize a brand new "shadcn-vue" project as usual using pnpm dlx shadcn-vue@latest init, but it unexpectedly failed with the following output:
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.
Message:
Failed to fetch from registry: https://shadcn-vue.com/init?base=reka&style=vega&baseColor=zinc&theme=blue&iconLibrary=remixicon&font=inter&rtl=false&menuAccent=subtle&menuColor=default-translucent&radius=default&preset=PRIVACY&template=vite&pointer=true&track=1
Suggestion:
Check your network connection and try again.Following the suggestion, I checked my network connection and inspected my network gateway logs. To my surprise, there were no network requests towards shadcn-vue.com originating from the CLI at all (except for my earlier browser visits). The HTTP request never actually left my machine.
I manually performed network requests to shadcn-vue.com using both curl and Node.js native fetch, and both worked without any issues.
After diagnosing the issue with Claude, I discovered that the issue was triggered by the https_proxy environment variable set on my system.
In dist/registry-hxzbzXMt.js, the original code is:
//#region src/registry/proxy.ts
const agent = process.env.https_proxy ? new ProxyAgent(process.env.https_proxy) : void 0;
//#endregionWhen I modified it to force disable the agent instantiation:
//#region src/registry/proxy.ts
const agent = void 0;
//#endregion:)
The CLI immediately succeeded in making the fetch request, and I was able to see the outbound network traffic appear in my gateway logs.
The detailed error stack trace captured before the CLI caught and masked the error:
FetchError: [GET] "https://shadcn-vue.com/init?...": <no response> fetch failed
[cause]: TypeError: fetch failed
at node:internal/deps/undici/undici:13510:13
at async $fetchRaw2 (...)
at async fetchRegistry (...)
...
[cause]: InvalidArgumentError: invalid onRequestStart method
at assertRequestHandler (.../[email protected]/node_modules/undici/lib/core/util.js:573:11)
at new Request (.../undici/lib/core/request.js:271:5)
at ProxyAgent.dispatch (.../undici/lib/dispatcher/proxy-agent.js:287:25)
at node:internal/deps/undici/undici:11144:55 {
code: 'UND_ERR_INVALID_ARG'
}Claude: There is a version mismatch/conflict between Node 24's built-in undici and the bundled
[email protected]dependency in "shadcn-vue". When https_proxy is present, shadcn-vue instantiates a ProxyAgent from its bundled undici. When passed to Node 24's native fetch (via ofetch), ProxyAgent fails internal assertions during onRequestStart and throws UND_ERR_INVALID_ARG. The request crashes internally before any TCP/HTTP connection is established.
BY THE WAY
:(
Before pinpointing the actual issue, I spent over 3 hours troubleshooting my local network, proxies, and checking whether my IP/User-Agent was blocked by WAF/Cloudflare.
I strongly suggest enhancing the CLI logging system by adding a debug/verbose flag (e.g., --verbose or --debug) or preserving the original error.cause in exception handling. Obscuring all process crashes behind a generic "Check your network connection" message makes debugging extremely misleading when the crash happens purely in the JavaScript runtime.
THANK U FOR TAKING THE TIME TO REVIEW THE ISSUE.
System Info
macOS Golden Gate 27.0 Beta
---
Node.js Version: v24.18.0
Package Manager: pnpm 10.33.0
shadcn-vue Version: 2.8.2Contributes
- I am willing to submit a PR to fix this issue
- I am willing to submit a PR with failing tests
Source: unovue/shadcn-vue