{"record":{"id":"2fb56af850787653","repo":"multica-ai/multica","slug":"s-must-be-an-absolute-path","errorCode":null,"errorMessage":"%s must be an absolute path","messagePattern":"(.+?) must be an absolute path","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_daemon.go","lineNumber":1863,"sourceCode":"\t}\n\treturn nil\n}\n\n// resolveDiskUsageRoot picks the directory to scan. A managed task reads the\n// daemon-injected root only: ResolveWorkspacesRoot falls back to a $HOME- and\n// profile-derived default, which for a task hosted by a named-profile daemon\n// resolves to the default root and reports a tree the task has nothing to do\n// with. Failing closed on a missing value keeps that guess out of the output.\nfunc resolveDiskUsageRoot(taskContext bool, profile, rootOverride string) (string, error) {\n\tif !taskContext {\n\t\treturn resolveWorkspacesRootForProfile(profile, rootOverride)\n\t}\n\troot := strings.TrimSpace(os.Getenv(daemon.TaskWorkspacesRootEnv))\n\tif root == \"\" {\n\t\treturn \"\", fmt.Errorf(\"daemon-managed task requires the daemon-injected workspaces root in %s\", daemon.TaskWorkspacesRootEnv)\n\t}\n\tif !filepath.IsAbs(root) {\n\t\treturn \"\", fmt.Errorf(\"%s must be an absolute path\", daemon.TaskWorkspacesRootEnv)\n\t}\n\treturn filepath.Clean(root), nil\n}\n\n// diskUsageNeedsParentStatus reports whether this invocation renders per-task\n// rows at all. The --by-workspace table has no STATUS column, so resolving\n// statuses for it would spend a network round trip — and, against an\n// unreachable server, a full timeout — on data nothing displays, turning a\n// local diagnostic into a command that hangs offline. JSON output always\n// carries the task array, so it still needs them even with --by-workspace.\nfunc diskUsageNeedsParentStatus(byWorkspace bool, output string) bool {\n\treturn !byWorkspace || output == \"json\"\n}\n\n// fillDiskUsageParentStatuses populates the report's STATUS column in place.\n//\n// This is best-effort and never fails the command: `disk-usage` is a local\n// diagnostic that has to keep working when the machine is offline or logged","sourceCodeStart":1845,"sourceCodeEnd":1881,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_daemon.go#L1845-L1881","documentation":"Thrown by resolveDiskUsageRoot in the multica CLI daemon command when the daemon-injected workspaces root environment variable (daemon.TaskWorkspacesRootEnv) is set to a relative path. For daemon-managed tasks the CLI refuses to guess the disk-usage tree root, because a profile-derived default could report a tree unrelated to the task; the value must be absolute.","triggerScenarios":"Running a disk-usage command with taskContext=true (daemon-managed task) where the daemon sets daemon.TaskWorkspacesRootEnv to a relative path like \"workspaces\" instead of \"/var/lib/multica/workspaces\". Only reached after the empty-value check passes, so the env var exists but is not filepath.IsAbs.","commonSituations":"A custom or misconfigured daemon launcher, a wrapper script exporting the env var with a relative path, or a newer daemon version whose injection format changed. Also happens when someone hand-runs a task command and manually sets the env var.","solutions":["Set the environment variable named by daemon.TaskWorkspacesRootEnv to an absolute path (e.g. /var/lib/multica/workspaces) and rerun the command","Check how the daemon was started: if you injected the variable yourself, use an absolute path derived from the workspace root","If running outside a daemon-managed context, unset the task-context flag/env so the CLI uses the profile root instead","Restart the daemon after fixing its configuration so it re-injects a correct absolute path"],"exampleFix":"# before\nexport MULTICA_TASK_WORKSPACES_ROOT=workspaces\nmultica daemon disk-usage\n\n# after\nexport MULTICA_TASK_WORKSPACES_ROOT=/var/lib/multica/workspaces\nmultica daemon disk-usage","handlingStrategy":"validation","validationCode":"package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n)\n\n// validateTaskWorkspacesRoot checks the daemon-injected root before\n// invoking any disk-usage command in task context.\nfunc validateTaskWorkspacesRoot(envName string) error {\n\troot := os.Getenv(envName)\n\tif root == \"\" {\n\t\treturn fmt.Errorf(\"%s is not set\", envName)\n\t}\n\tif !filepath.IsAbs(root) {\n\t\treturn fmt.Errorf(\"%s must be an absolute path, got %q\", envName, root)\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always inject workspaces roots as absolute paths from daemon launchers","Add a startup assertion in the daemon that validates the env var with filepath.IsAbs before spawning tasks","Log the resolved root at daemon start so misconfiguration is visible early"],"tags":["cli","daemon","environment","filesystem","path-validation"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}