multica-ai/multica · error
could not determine daemon PID from health endpoint
Error message
could not determine daemon PID from health endpoint
What it means
runDaemonStop found a live daemon on the health port and verified its identity, but the health payload lacked a usable numeric `pid` field (missing, wrong type, or 0). Stop cannot proceed because the PID to signal comes from whatever answered on the port.
Solutions
- Check the daemon health endpoint; restart the daemon if it is unhealthy.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at server/cmd/multica/cmd_daemon.go:1286 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/e59c30a05086176a.
Report an issue: GitHub.
Appendix: source
Thrown at server/cmd/multica/cmd_daemon.go:1286
health := checkDaemonHealthOnPort(ctx, healthPort)
if !daemonAlive(health) {
label := "Daemon"
if profile != "" {
label = fmt.Sprintf("Daemon [%s]", profile)
}
fmt.Fprintf(os.Stderr, "%s is not running.\n", label)
return nil
}
// The PID to kill comes from whatever answered on this port, so verify it
// is ours before signalling it.
if err := daemonIdentityMismatch(health, profile, healthPort); err != nil {
return err
}
pid, ok := health["pid"].(float64)
if !ok || pid == 0 {
return fmt.Errorf("could not determine daemon PID from health endpoint")
}
process, err := os.FindProcess(int(pid))
if err != nil {
return fmt.Errorf("find process %d: %w", int(pid), err)
}
// Request graceful shutdown via the daemon's HTTP /shutdown endpoint
// rather than an OS signal. On Windows the daemon is spawned with
// DETACHED_PROCESS so it shares no console with us, which means
// GenerateConsoleCtrlEvent can't reach it; HTTP works on both
// platforms and triggers the same context-cancel path the daemon
// already uses for self-restart.
if err := requestDaemonShutdown(healthPort); err != nil {
fmt.Fprintf(os.Stderr, "Graceful shutdown request failed: %v — falling back to forced kill.\n", err)
if kerr := process.Kill(); kerr != nil {
return fmt.Errorf("kill daemon (pid %d): %w", int(pid), kerr)
}View on GitHub (pinned to 2c0912b6ec)