{"record":{"id":"efc931017da431e7","repo":"multica-ai/multica","slug":"daemon-has-d-active-s-setup-saved-the-new-confi","errorCode":null,"errorMessage":"daemon has %d active %s; setup saved the new configuration but left the running daemon unchanged to avoid cancelling work. Wait for the active work to finish, then run '%s' to apply the new configuration","messagePattern":"daemon has (.+?) active (.+?); setup saved the new configuration but left the running daemon unchanged to avoid cancelling work\\. Wait for the active work to finish, then run '(.+?)' to apply the new configuration","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/cmd/multica/cmd_setup.go","lineNumber":305,"sourceCode":"\nfunc dispatchDaemonAfterSetup(\n\tcmd *cobra.Command,\n\targs []string,\n\thealth map[string]any,\n\tstart setupDaemonRunner,\n\trestart setupDaemonRunner,\n) error {\n\tif daemonAlive(health) {\n\t\tif activeTasks := daemonActiveTaskCount(health); activeTasks > 0 {\n\t\t\ttaskLabel := \"tasks\"\n\t\t\tif activeTasks == 1 {\n\t\t\t\ttaskLabel = \"task\"\n\t\t\t}\n\t\t\trestartCmd := \"multica daemon restart\"\n\t\t\tif profile := resolveProfile(cmd); profile != \"\" {\n\t\t\t\trestartCmd += \" --profile \" + profile\n\t\t\t}\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"daemon has %d active %s; setup saved the new configuration but left the running daemon unchanged to avoid cancelling work. Wait for the active work to finish, then run '%s' to apply the new configuration\",\n\t\t\t\tactiveTasks,\n\t\t\t\ttaskLabel,\n\t\t\t\trestartCmd,\n\t\t\t)\n\t\t}\n\t\tfmt.Fprintln(os.Stderr, \"\\nRestarting daemon to apply the new configuration...\")\n\t\treturn restart(cmd, args)\n\t}\n\n\tfmt.Fprintln(os.Stderr, \"\\nStarting daemon...\")\n\treturn start(cmd, args)\n}\n\nfunc daemonActiveTaskCount(health map[string]any) int64 {\n\tswitch count := health[\"active_task_count\"].(type) {\n\tcase float64:\n\t\treturn int64(count)","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_setup.go#L287-L323","documentation":"Deliberate safety refusal from the post-setup daemon restart logic: the daemon is alive, reports more than zero active tasks, and setup therefore refuses to restart it, because a restart would cancel in-flight work. The new configuration IS saved; only the running daemon still uses the old deployment. The message includes the exact restart command, profile-aware.","triggerScenarios":"Running `multica setup` or `multica setup self-host` while the daemon has 1+ active tasks (per daemonActiveTaskCount from its health endpoint). Any deployment switch (cloud→self-host, server URL change) under active work triggers it.","commonSituations":"Re-pointing a busy workstation to a new server during work hours; CI agents with queued tasks; switching profiles while background sync/agents run.","solutions":["Wait for the reported active tasks to finish (check `multica daemon status`).","Run the exact command from the error message, e.g. `multica daemon restart --profile <P>`.","If the work must be abandoned, explicitly run `multica daemon restart` accepting the cancellation.","For unattended automation, schedule setup at idle times or drain tasks first."],"exampleFix":"# before\nmultica setup self-host --server-url https://api.co --app-url https://app.co\n# error: daemon has 3 active tasks ...\n# after (once tasks drain)\nmultica daemon restart --profile default","handlingStrategy":"retry","validationCode":"# Poll task count (single check, no busy loop) before restarting\nmultica daemon status --profile \"$P\" --output json | jq -e '.active_tasks == 0' >/dev/null || echo \"tasks still active; not restarting\"","typeGuard":null,"tryCatchPattern":"Parse the count and restart command out of the message; treat as a soft-failure: pause the pipeline until tasks drain, then execute the suggested `multica daemon restart --profile <P>` and verify status.","preventionTips":["Don't force-restart daemons with active tasks unless cancellation is intended.","Automate setup at scheduled idle times.","Remember config IS saved at this point — only the restart is pending."],"tags":["go","cli","daemon","setup","concurrency","safety-guard"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}