- Splash Window Timing — Made splash window creation async and wait for full load
- Server Wait Time — Added 2-second delay after server responds to let Open WebUI initialize
- Progress Updates — Added safety checks and DOM ready event
- Error Handling — Wrapped tool/IPC initialization in try-catch to prevent blocking
// Before: Immediate splash creation
createSplash();
// After: Wait for splash to be fully ready
await createSplash(); // Now async, waits for renderer to be ready// Before: Show main window immediately after server responds
await waitForServer(splash);
createMain();
// After: Wait 2 seconds after server responds + wait for render
await waitForServer(splash); // Now waits 2s after first response
createMain();
await main.loadURL(WEBUI_URL);
await new Promise(resolve => setTimeout(resolve, 500)); // Wait for render-
Rebuild CHAD:
npm run build
-
Run with Console Output:
npm start
-
Watch for Console Messages: You should see:
Initializing CHAD tools... Tools initialized successfully Splash screen ready Server ready Main window created IPC handlers set up Main window loaded CHAD is ready! -
Check for Errors: If you see warnings like:
"Warning: Failed to initialize tools"— Tools didn't load (non-critical)"Warning: Failed to setup IPC"— IPC didn't initialize (non-critical for basic UI)- Any other errors will be shown in red
If the loader is still stuck, add DevTools to the splash window temporarily:
In src/main.ts, add after line 71:
splash.loadFile(path.join(__dirname, "loading.html"));
splash.webContents.openDevTools(); // ← Add this line temporarilyThen rebuild and run. The splash window will show DevTools where you can:
- Check the Console tab for JavaScript errors
- Look for
window.apiavailability - See if IPC messages are being received
Cause: Preload script not loading
Fix:
- Check that
dist/preload.jsexists - Verify
preload: path.join(__dirname, "preload.js")in createSplash() - Rebuild:
npm run build
Cause: IPC not working or splash not ready
Fix:
- Check console for "Splash screen ready" message
- Verify
loading-progressIPC channel name matches in preload.ts - Check DevTools console in splash window
Cause: Server not fully initialized before loading URL
Current Fix: 2-second wait after server responds
If still happening: Increase wait time in waitForServer():
// Line ~36 in main.ts
setTimeout(() => {
clearInterval(timer);
resolve();
}, 3000); // ← Increase to 3 or 4 secondsCause: Main window creation or URL loading failing
Fix:
- Check if Open WebUI dev server is actually running on port 5173
- Test manually: Open browser to http://localhost:5173
- Check
open-webui/folder has node_modules installed
Test if Open WebUI runs independently:
cd open-webui
npm run devThen open browser to http://localhost:5173
If this works but CHAD doesn't, the issue is in the Electron integration.
Verify all required files are compiled:
# Should exist after build
dir dist\*.js
dir dist\loading.html
# Required:
# - dist/main.js
# - dist/preload.js
# - dist/ipc.js
# - dist/orchestrator.js
# - dist/loading.html
# - dist/ai/cluster.js
# - dist/tools/*.jsOnce the main window loads (even if splash is stuck), open DevTools (F12) and test:
// Should not be undefined
console.log(window.chad);
// Should not throw error
window.chad.health().then(console.log);If window.chad is undefined:
- Preload script didn't run in main window
- Check main window has preload path set
If build fails:
-
Check for TypeScript errors:
npx tsc -p tsconfig.json --noEmit
-
Clean build:
npm run clean npm run build
-
Check Node.js version:
node --version # Should be 18 or higher
Create test-minimal.js in root:
const { app, BrowserWindow } = require('electron');
const path = require('path');
app.whenReady().then(() => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'dist', 'preload.js'),
}
});
win.loadFile(path.join(__dirname, 'dist', 'loading.html'));
win.webContents.openDevTools();
// Send test progress
setInterval(() => {
const percent = Math.floor(Math.random() * 100);
win.webContents.send('loading-progress', { percent, eta: 5 });
}, 500);
});Run with: npx electron test-minimal.js
This tests ONLY the splash screen and IPC.
With the fixes:
- 0s — Splash appears (CHAD logo, "Starting...")
- 0-3s — Loading bar starts animating (0% → 90%)
- 3-5s — Server ready, bar reaches 95%
- 5-6s — Main window loading (hidden)
- 6s — Bar reaches 100%, "Ready!"
- 6.3s — Main window shows, splash closes
Total: ~6-7 seconds from start to Open WebUI visible
If the loader is still stuck on "Starting..." after these fixes:
- Enable DevTools on splash (see above)
- Check Console for errors
- Verify
window.apiexists - Run minimal test (see above)
- Share console output — Post the console messages to help diagnose
Once the startup works:
- Test
window.chadAPI in main window - Verify Ollama is running and models loaded
- Try a chat request
- Set up Open WebUI integration
TL;DR for Current Issue:
Run these commands:
npm run build
npm startWatch console output. If still stuck, enable DevTools on splash window to see browser console errors.