{"record":{"id":"aab41c5dcccbe476","repo":"multica-ai/multica","slug":"kill-daemon-pid-d-w","errorCode":null,"errorMessage":"kill daemon (pid %d): %w","messagePattern":"kill daemon \\(pid (.+?)\\): %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_daemon.go","lineNumber":1303,"sourceCode":"\tif !ok || pid == 0 {\n\t\treturn fmt.Errorf(\"could not determine daemon PID from health endpoint\")\n\t}\n\n\tprocess, err := os.FindProcess(int(pid))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"find process %d: %w\", int(pid), err)\n\t}\n\n\t// Request graceful shutdown via the daemon's HTTP /shutdown endpoint\n\t// rather than an OS signal. On Windows the daemon is spawned with\n\t// DETACHED_PROCESS so it shares no console with us, which means\n\t// GenerateConsoleCtrlEvent can't reach it; HTTP works on both\n\t// platforms and triggers the same context-cancel path the daemon\n\t// already uses for self-restart.\n\tif err := requestDaemonShutdown(healthPort); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Graceful shutdown request failed: %v — falling back to forced kill.\\n\", err)\n\t\tif kerr := process.Kill(); kerr != nil {\n\t\t\treturn fmt.Errorf(\"kill daemon (pid %d): %w\", int(pid), kerr)\n\t\t}\n\t}\n\n\tfmt.Fprintf(os.Stderr, \"Stopping daemon (pid %d)...\\n\", int(pid))\n\n\t// Poll health endpoint until daemon is gone.\n\tfor i := 0; i < 10; i++ {\n\t\ttime.Sleep(500 * time.Millisecond)\n\t\tctx2, cancel2 := context.WithTimeout(context.Background(), 1*time.Second)\n\t\th := checkDaemonHealthOnPort(ctx2, healthPort)\n\t\tcancel2()\n\t\tif !daemonAlive(h) {\n\t\t\tos.Remove(daemonPIDPathForProfile(profile))\n\t\t\tfmt.Fprintln(os.Stderr, \"Daemon stopped.\")\n\t\t\treturn nil\n\t\t}\n\t}\n","sourceCodeStart":1285,"sourceCodeEnd":1321,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_daemon.go#L1285-L1321","documentation":"Error \"kill daemon (pid %d): %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_daemon.go:1303 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions to signal the daemon process; kill it manually if needed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}