{"record":{"id":"4f1829a10512ac75","repo":"multica-ai/multica","slug":"s-is-not-available-inside-a-daemon-managed-task","errorCode":null,"errorMessage":"%s is not available inside a daemon-managed task","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":439,"sourceCode":"\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)\n\t\t// Only a marker we can read AND whose managed_by matches counts as a\n\t\t// daemon-task signal. Any other outcome — missing file, unreadable","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L421-L457","documentation":"The bare requireHumanLocalCommand refusal with no marker: the process genuinely carries daemon task identity (env-injected), so human-local commands are refused without a file-remedy suffix. Task API commands remain available with the injected mat_ token; only authentication/daemon/profile commands are denied.","triggerScenarios":"A command in the human-local deny list is executed inside a legitimately daemon-managed task — e.g. an agent's script calling `multica login`, `multica daemon start`, or profile setup.","commonSituations":"Agent scaffolding or install scripts copied from human docs that include a login step; CI jobs reusing task credentials but trying to rotate or reauth them.","solutions":["Remove the human-local command from the task's script — the task should use the injected mat_ token for API commands.","Perform login/daemon setup outside the task, in the human's own shell.","Replace the denied call with the equivalent task-safe API command if one exists."],"exampleFix":"# before: inside a daemon-managed task script\nmultica login --token $HUMAN_TOKEN\n\n# after: rely on the injected task token; drop the login step\nmultica agent list","handlingStrategy":"validation","validationCode":"# In task scripts, gate human-local commands out entirely:\nis_daemon_task() { [ -n \"$MULTICA_TASK_ID\" ]; }\nhuman_only() {\n  if is_daemon_task; then echo \"$1 is not available inside a daemon-managed task\" >&2; exit 1; fi\n}\nhuman_only multica-login","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep login/daemon/profile setup in human-run bootstrap scripts, never in task scripts.","Task scripts should consume the injected mat_ token, not manage credentials.","Smoke-test task scaffolding to ensure no human-local command appears in it."],"tags":["go","cli","daemon","authentication"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}