{"record":{"id":"8b776d5b1dc14327","repo":"multica-ai/multica","slug":"daemon-status-profile-is-not-available-inside-a","errorCode":null,"errorMessage":"daemon status --profile is not available inside a daemon-managed task","messagePattern":"daemon status --profile is not available inside a daemon-managed task","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_daemon.go","lineNumber":1439,"sourceCode":"\t}\n\treturn nil\n}\n\n// 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)\"","sourceCodeStart":1421,"sourceCodeEnd":1457,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_daemon.go#L1421-L1457","documentation":"daemonStatusHealthPort fails closed when `daemon status --profile <name>` is run inside a daemon-managed task. A task may only report on the daemon hosting it; deriving a port from an arbitrary profile could probe a different daemon.","triggerScenarios":"Thrown at server/cmd/multica/cmd_daemon.go:1439 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run daemon status without --profile outside a daemon-managed task."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}