Native module issues
Emdash uses three native Node.js modules that must be compiled for Electron:sqlite3, node-pty, and keytar.
Native module crashes on startup
Native module crashes on startup
sqlite3, node-pty, or keytarCommon error messages:Rebuild native modules
Clean install if rebuild fails
node_modules and reinstalls everything from scratch.Verify Node version
.nvmrc file:sqlite3 binding errors
sqlite3 binding errors
-
Rebuild sqlite3 specifically:
-
If that fails, use the fallback database driver:
- Check the database file isn’t corrupted (see Database corruption)
node-pty errors on Windows
node-pty errors on Windows
-
Ensure you have Windows Build Tools:
-
Rebuild node-pty:
- If using WSL, build inside WSL (not Windows)
keytar errors (Linux)
keytar errors (Linux)
-
Install libsecret:
-
Rebuild keytar:
-
Start gnome-keyring if not running:
Agent and PATH issues
Agent not found / command not in PATH
Agent not found / command not in PATH
PATH configuration.Solutions:Launch Emdash from terminal
Add agent to system PATH
~/.zshrc, ~/.bashrc, etc.)Check Emdash PATH setup
src/main/main.ts. If your agent still isn’t found, you may need to add the installation directory to this logic.Common locations Emdash checks:/usr/local/bin/opt/homebrew/bin~/.local/bin~/bin~/.nvm/versions/node/*/bin~/.npm-global/bin
Agent installed but not detected
Agent installed but not detected
-
Check the provider definition in
src/shared/providers/registry.ts:- Verify
commandsarray matches the actual binary name - Ensure
detectableis not set tofalse - Check
versionArgssucceeds (e.g.,claude --version)
- Verify
- Restart Emdash — detection runs on startup
- Check the console for detection errors (Cmd+Option+I / Ctrl+Shift+I)
API keys not available to agent
API keys not available to agent
ANTHROPIC_API_KEY not found)Why this happens:PTYs use a minimal environment that doesn’t inherit process.env. Only keys in AGENT_ENV_VARS are passed through.Solutions:-
Add the key to
AGENT_ENV_VARSinsrc/main/services/ptyManager.ts: -
Set the key in your shell environment:
- Restart Emdash to pick up the new environment
Git and worktree issues
Worktree creation fails
Worktree creation fails
Cannot switch to worktree branch
Cannot switch to worktree branch
-
Delete the conflicting branch:
- Let Emdash recreate it automatically
-
If the branch exists in remote, fetch and track it:
Preserved files not copying to worktree
Preserved files not copying to worktree
.env, .envrc, or other gitignored files missing in worktreeSolutions:-
Check
.emdash.jsonin project root: - Ensure the files exist in the main repo (not just in another worktree)
- Re-create the task to trigger a fresh worktree with preserved files
Database issues
Database corruption
Database corruption
Locate the database file
- macOS:
~/Library/Application Support/emdash/emdash.db - Linux:
~/.config/emdash/emdash.db - Windows:
%APPDATA%\emdash\emdash.db
Migration errors
Migration errors
-
Check the current schema version:
-
If migrations are stuck, manually run them:
- If migrations fail, restore from backup or delete the database
Database locked errors
Database locked errors
- Ensure only one instance of Emdash is running
-
Check for zombie processes:
-
Remove stale lock files:
PTY and terminal issues
PTY exits immediately after spawn
PTY exits immediately after spawn
- Check agent CLI is correct in provider definition
-
Test the command manually:
- Check for missing dependencies (Python, Node.js, etc.)
- Look for errors in Electron console (Cmd+Option+I / Ctrl+Shift+I)
Terminal output garbled or missing
Terminal output garbled or missing
- Try resizing the terminal pane
- Restart the PTY (close and reopen the task)
-
Check PTY dimensions are correct:
- Disable terminal features like ligatures or complex rendering
PTY not cleaning up on exit
PTY not cleaning up on exit
-
Manually kill tmux sessions:
-
Kill orphaned PTYs:
-
Check
ptyManager.tscallsremovePty()on exit
Development and build issues
TypeScript errors after pulling changes
TypeScript errors after pulling changes
pnpm run type-check fails with type errorsSolutions:-
Reinstall dependencies:
-
Clear TypeScript cache:
-
Check you’re on the correct Node version:
-
Verify path aliases are correct in
tsconfig.jsonandtsconfig.main.json
Hot reload not working
Hot reload not working
- Renderer process: Should hot-reload via Vite automatically
- Main process: Requires full restart (Ctrl+C then
pnpm run dev) - Native modules: Require
pnpm run rebuild
Build fails on CI
Build fails on CI
- Ensure CI uses correct Node version (22.x)
-
Check native module binaries aren’t committed:
- Verify all required environment variables are set in CI
- Check platform-specific dependencies are installed (see native module section)
Tests failing locally
Tests failing locally
pnpm exec vitest run failsSolutions:-
Ensure test environment is correct in
vite.config.ts: -
Check mocks are correctly set up (tests use
vi.mock()) -
Verify temp directories are writable:
-
Run a specific test to isolate the issue:
Platform-specific issues
macOS: App not signed / can't be opened
macOS: App not signed / can't be opened
-
Remove quarantine attribute:
- Allow app in System Preferences → Security & Privacy
-
For development builds, disable Gatekeeper temporarily:
Re-enable after:
Linux: Wayland compatibility issues
Linux: Wayland compatibility issues
-
Force X11 mode:
-
Or use Wayland explicitly:
-
Ensure required env vars are set:
Windows: PowerShell execution policy blocks scripts
Windows: PowerShell execution policy blocks scripts
pnpm commands fail with “execution policy” errorSolutions:-
Allow scripts for current user:
-
Or run in Administrator mode:
Debugging tips
Enable Electron DevTools
Cmd+Option+I (macOS) or Ctrl+Shift+I (Windows/Linux) to open DevTools.Check Console tab for errors.Check main process logs
pnpm run dev.Look for errors from log.error() calls.Getting help
If you’re still stuck:- Check GitHub issues: https://github.com/emdash-ai/emdash/issues
- Search AGENTS.md: The internal dev guide has detailed architecture notes
- File a bug: Include logs, error messages, OS/Node versions, and steps to reproduce
- Operating system and version
- Node.js version (
node --version) - Emdash version or commit hash
- Full error message and stack trace
Preventive maintenance
Rebuild native modules after updates
node-pty, sqlite3, or keytar:Next steps
- Adding providers — Extend Emdash with new agents
- SSH connection setup — Debug remote connection issues
- Linear and Jira integration — Fix integration problems