{"record":{"id":"c099c6fa357c7796","repo":"multica-ai/multica","slug":"s-is-not-available-inside-a-daemon-managed-task-s","errorCode":null,"errorMessage":"%s is not available inside a daemon-managed task%s","messagePattern":"(.+?) is not available inside a daemon-managed task(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":437,"sourceCode":"\treturn nil\n}\n\n// requireHumanLocalCommand rejects commands whose purpose is to authenticate,\n// set up, or operate the human-owned local daemon/profile. Task API commands\n// remain available with the injected mat_ token; these local commands do not.\nfunc requireHumanLocalCommand(command string) error {\n\tif !inDaemonTaskIdentityContext() {\n\t\treturn nil\n\t}\n\t// A task-scoped workdir marker with no task identity in the environment is\n\t// the one signal that can outlive the task that wrote it: a local_directory\n\t// run that never cleaned up leaves it in the user's own repository, where it\n\t// disables every command below this function for that whole directory tree\n\t// until someone deletes the file by hand (MUL-6132). Name it, so the user\n\t// knows which file that is; the bare message below sends them to the source\n\t// instead. Mirrors newAPIClient's leftover-marker handling.\n\tif markerPath := leftoverDaemonTaskMarkerPath(); markerPath != \"\" {\n\t\treturn fmt.Errorf(\"%s is not available inside a daemon-managed task%s\", command, leftoverMarkerSuffix(markerPath))\n\t}\n\treturn fmt.Errorf(\"%s is not available inside a daemon-managed task\", command)\n}\n\nfunc hasDaemonTaskContextMarker() bool {\n\treturn daemonTaskContextMarkerPath() != \"\"\n}\n\n// daemonTaskContextMarkerPath walks up from the current working directory and\n// returns the path of the first readable daemon-task marker whose managed_by\n// matches, or \"\" when none is found.\nfunc daemonTaskContextMarkerPath() string {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tfor {\n\t\tmarkerPath := filepath.Join(dir, execenv.TaskContextMarkerRelPath)","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L419-L455","documentation":"requireHumanLocalCommand blocks commands that operate the human-owned daemon/profile (login, daemon control, profile management) inside a daemon-managed task, because running them with task credentials would corrupt the human's setup. This variant fires when the daemon identity context coexists with a leftover marker file, and the message names that file.","triggerScenarios":"inDaemonTaskIdentityContext() is true, the command is in the human-local deny list, and leftoverDaemonTaskMarkerPath() finds a stale marker — the marker that outlived its task disables every human-local command for the whole directory tree until deleted by hand (MUL-6132).","commonSituations":"User tries `multica login` or daemon management inside a repository where a crashed local_directory task left its marker; the tree stays poisoned across shells and sessions.","solutions":["Delete the marker file whose path the error appends.","Verify recovery by running the same command again from the same directory.","Report recurring marker leaks from crashed daemon tasks so the cleanup-on-failure path gets fixed."],"exampleFix":"# before\nmultica login\n# -> login is not available inside a daemon-managed task ... <marker path>\n\n# after\nrm /path/to/repo/.multica/daemon-task-marker.json\nmultica login","handlingStrategy":"validation","validationCode":"# Before human-local commands (login, daemon ops), verify no marker up the tree:\nif find . -name daemon-task-marker.json -path '*/.multica/*' 2>/dev/null | grep -q .; then\n  echo \"inside a stale daemon-managed tree; remove the marker first\" >&2\n  exit 1\nfi\nmultica login","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never run login/daemon commands from inside a directory that served as a daemon task workdir.","Clean up markers when tasks crash; add cleanup hooks to task wrappers.","Report recurring MUL-6132-style leaks with the marker path from the error message."],"tags":["go","cli","daemon","authentication","environment"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}