{"record":{"id":"88231ba842fbbbe8","repo":"multica-ai/multica","slug":"daemon-status-inside-a-daemon-managed-task-require","errorCode":null,"errorMessage":"daemon status inside a daemon-managed task requires the daemon-injected MULTICA_DAEMON_PORT","messagePattern":"daemon status inside a daemon-managed task requires the daemon-injected MULTICA_DAEMON_PORT","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_daemon.go","lineNumber":1443,"sourceCode":"// daemonStatusHealthPort resolves which daemon `status` should probe. Outside a\n// task that is the --profile-derived port, even when a stale\n// MULTICA_DAEMON_PORT remains in the host environment. Inside a managed task it\n// is the daemon-injected port and nothing else: healthPortForProfile hashes\n// whatever profile name the caller passes, so deriving the port there would let\n// a task report on a daemon that is not the one hosting it — and for a task\n// hosted by a named-profile daemon it would silently probe the default daemon\n// instead. A missing port fails closed rather than guessing.\nfunc daemonStatusHealthPort(cmd *cobra.Command) (int, error) {\n\tprofile := resolveProfile(cmd)\n\tif !inDaemonTaskIdentityContext() {\n\t\treturn healthPortForProfile(profile), nil\n\t}\n\tif profile != \"\" {\n\t\treturn 0, fmt.Errorf(\"daemon status --profile is not available inside a daemon-managed task\")\n\t}\n\traw := strings.TrimSpace(os.Getenv(\"MULTICA_DAEMON_PORT\"))\n\tif raw == \"\" {\n\t\treturn 0, fmt.Errorf(\"daemon status inside a daemon-managed task requires the daemon-injected MULTICA_DAEMON_PORT\")\n\t}\n\tport, err := strconv.Atoi(raw)\n\tif err != nil || port <= 0 {\n\t\treturn 0, fmt.Errorf(\"invalid MULTICA_DAEMON_PORT %q inside a daemon-managed task\", raw)\n\t}\n\treturn port, nil\n}\n\n// describeDaemonManager turns the daemon's launched_by tag into something a\n// user can act on. Unknown values are passed through rather than dropped: a\n// newer daemon naming a manager this CLI predates is still worth showing.\nfunc describeDaemonManager(launchedBy string) string {\n\tif launchedBy == \"desktop\" {\n\t\treturn \"Multica Desktop app (start and stop it from the app)\"\n\t}\n\treturn launchedBy\n}\n","sourceCodeStart":1425,"sourceCodeEnd":1461,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_daemon.go#L1425-L1461","documentation":"Error \"daemon status inside a daemon-managed task requires the daemon-injected MULTICA_DAEMON_PORT\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_daemon.go:1443 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The MULTICA_DAEMON_PORT variable is missing; run status from outside the task or let the daemon inject it."],"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-15T17:31:12.345Z"}