slopus/happy · critical
Entrypoint ${entrypoint} does not exist
Error message
Entrypoint ${entrypoint} does not exist What it means
spawnHappyCLI launches the happy CLI as a child process (via bun or node). Before spawning, it sanity-checks that the resolved entrypoint file exists on disk with existsSync; if not, it throws this Error immediately instead of letting the runtime fail with an opaque ENOENT. This guards against broken installs, stale version paths, or invalid HOME-based path resolution.
Source
Thrown at packages/happy-cli/src/utils/spawnHappyCLI.ts:101
// However, we log it as 'happy' here because other engineers are typically looking
// for when "happy" was started and don't care about the underlying node process
// details and flags we use to achieve the same result.
const fullCommand = `happy ${args.join(' ')}`;
logger.debug(`[SPAWN HAPPY CLI] Spawning: ${fullCommand} in ${directory}`);
// Use the same Node.js flags that the wrapper script uses
const nodeArgs = [
'--no-warnings',
'--no-deprecation',
entrypoint,
...args
];
// Sanity check of the entrypoint path exists
if (!existsSync(entrypoint)) {
const errorMessage = `Entrypoint ${entrypoint} does not exist`;
logger.debug(`[SPAWN HAPPY CLI] ${errorMessage}`);
throw new Error(errorMessage);
}
const runtime = isBun() ? 'bun' : 'node';
// Use cross-spawn so `node` resolves to `node.exe` on Windows.
// Since Node's CVE-2024-27980 hardening, child_process.spawn('node', ...)
// on Windows no longer falls back to appending `.exe`, producing ENOENT
// even when node is on PATH (issue #1082).
return crossSpawn(runtime, nodeArgs, {
windowsHide: true,
...options,
});
}
View on GitHub (pinned to b824cd0a46)
Solutions
- Reinstall/update the happy CLI so the entrypoint file exists (npm install -g happy-coder or the package's recommended update command).
- Log/inspect the entrypoint path in the error message and verify it exists: ls <path>.
- Kill stale daemons/processes that pinned an old version path, then restart (restartOnStaleVersionAndHeartbeat usually recovers this automatically).
- If running from source, build the CLI so the entrypoint artifact is generated.
- Check HOME/cache env vars (e.g. HOME, XDG dirs) resolve to a real writable directory.
Example fix
// before
spawnHappyCLI(['doctor']); // throws: Entrypoint /home/me/.npm/.../cli.js does not exist
// after
// reinstall so the bundle exists, or guard:
if (!existsSync(entrypoint)) { await updateHappyCLI(); }
await spawnHappyCLI(['doctor']); Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
// resolve entrypoint the same way the library does, then:
if (!existsSync(entrypoint)) {
throw new Error(`happy CLI entrypoint missing at ${entrypoint}; reinstall happy-coder`);
} Type guard
function isEntrypointPresent(path: string): boolean {
return typeof path === 'string' && path.length > 0 && existsSync(path);
} Try / catch
try {
await spawnHappyCLI(args);
} catch (err) {
if ((err as Error).message.startsWith('Entrypoint')) {
await reinstallOrUpdateHappyCLI();
await spawnHappyCLI(args); // retry once after reinstall
} else throw err;
} Prevention
- Keep the CLI installed and updated in the same package manager used to run it.
- Restart daemons after upgrades so they don't pin deleted version paths.
- Verify the install after updates: run `happy --version` before spawning programmatically.
- Avoid manipulating or cleaning the CLI's cache/install directory while processes run.
When it happens
Trigger: Calling spawnHappyCLI (directly or via terminalHappyProcess, daemonProcess, happyProcess, restartOnStaleVersionAndHeartbeat, or child) when the resolved entrypoint path — typically a compiled CLI script under a versioned directory — does not exist on disk at spawn time.
Common situations: Partial or corrupted npm/global install where the CLI bundle was removed; a stale daemon referencing an old version directory that was cleaned by an update; HOME or cache-directory misconfiguration pointing at a nonexistent path; running from a source checkout without building the entrypoint; filesystem race during an upgrade while the daemon restarts.
Related errors
- taskkill exited with code ${result.status}
- Failed to create stdio pipes
- Usage: happy acp <agent-name> or happy acp -- <command> [arg
- Missing command after "--". Usage: happy acp -- <command> [a
- Claude local launcher not found. Please ensure HAPPY_PROJECT
AI-assisted analysis of slopus/happy@b824cd0a46 (2026-08-31).
Data as JSON: /api/errors/259d30d291b6185f.
Report an issue: GitHub.