Build fails with "Error: Debug Failure." immediately after successful vite build (Vite 5.4.21 + React)
I'm seeing a consistent build failure on Vercel where the build succeeds through vite build completely, then crashes 0.5s later with no stack trace.
Build log pattern (every time):
vite v5.4.21 building for production... transforming... ✓ 72 modules transformed. rendering chunks... computing gzip size... dist/assets/favicon-.svg 0.27 kB dist/index.html 1.86 kB dist/assets/index-.js 483.03 kB ✓ built in 2.3s Error: Debug Failure.
Stack: Vite 5.4.21, /plugin-react 4.2.0, React 18.2.0, /supabase-js 2.39.0
What I've tried (all reproduce the identical failure):
- Build cache enabled / disabled / "not available" (fresh project re-import)
- Pinning Node.js to 20.x via "engines" in package.json (also tried default 24.x) — same crash either way
- Reviewed every file in /api/ (5 serverless functions, all plain ES modules, no TypeScript syntax) — none appear malformed
- Removed/renamed the one /api/ file that doesn't export a default handler (api/rate-limit.js → _rate-limit.js, which Vercel ignores) — same crash
The exact same code builds with zero errors locally: npm install && npm run build → ✓ built in 1.94s, no errors
Vercel support (Hobby plan) confirmed "Debug Failure" is a known internal TypeScript compiler (tsc) crash, typically from their internal build analyzer tracing Serverless Functions post-build, but couldn't pinpoint the specific cause without server-side log access (not available on Hobby).
Has anyone seen this exact "Error: Debug Failure." after a successful vite build, and found what actually triggers it? Happy to share repo structure or any config files that would help.
Deployment ref: dpl_7ZmbVXG3xpc28RL56aEwgk1NVJcT