{"record":{"id":"20f2525d6ec2f655","repo":"multica-ai/multica","slug":"execenv-workspaces-root-is-required","errorCode":null,"errorMessage":"execenv: workspaces root is required","messagePattern":"execenv: workspaces root is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/execenv.go","lineNumber":329,"sourceCode":"\tlogger *slog.Logger // for cleanup logging\n}\n\n// PredictRootDir returns the env root path that Prepare would create for the\n// given task, without performing any I/O. Callers use this to claim ownership\n// of the directory (e.g. against the GC loop) before Prepare/Reuse runs.\nfunc PredictRootDir(workspacesRoot, workspaceID, taskID string) string {\n\tif workspacesRoot == \"\" || workspaceID == \"\" || taskID == \"\" {\n\t\treturn \"\"\n\t}\n\treturn filepath.Join(workspacesRoot, workspaceID, shortID(taskID))\n}\n\n// Prepare creates an isolated execution environment for a task.\n// The workdir starts empty (no repo checkouts). The agent checks out repos\n// on demand via `multica repo checkout <url>`.\nfunc Prepare(params PrepareParams, logger *slog.Logger) (*Environment, error) {\n\tif params.WorkspacesRoot == \"\" {\n\t\treturn nil, fmt.Errorf(\"execenv: workspaces root is required\")\n\t}\n\tif params.WorkspaceID == \"\" {\n\t\treturn nil, fmt.Errorf(\"execenv: workspace ID is required\")\n\t}\n\tif params.TaskID == \"\" {\n\t\treturn nil, fmt.Errorf(\"execenv: task ID is required\")\n\t}\n\n\tenvRoot := filepath.Join(params.WorkspacesRoot, params.WorkspaceID, shortID(params.TaskID))\n\n\t// Self-heal the root-level daemon marker on every task start so a marker\n\t// removed while the daemon runs is restored before the agent spawns. The\n\t// per-workdir marker written below only covers cwds inside the workdir;\n\t// the root marker keeps the CLI fail-closed guard active for subprocesses\n\t// that lose all MULTICA_* env vars AND escape above the workdir. Non-fatal:\n\t// without it the workdir marker still protects the common case.\n\tif err := EnsureWorkspacesRootMarker(params.WorkspacesRoot); err != nil && logger != nil {\n\t\tlogger.Warn(\"execenv: workspaces root marker not written; fail-closed guard limited to the task workdir\", \"error\", err)","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/execenv.go#L311-L347","documentation":"Required-parameter guard: fires when the workspaces root argument/field is empty. Every execenv operation (Prepare and its helpers) is anchored at the workspaces root, and PredictRootDir likewise returns \"\" for it, so an empty value means the environment cannot be located or created and is refused before any I/O.","triggerScenarios":"Thrown at server/internal/daemon/execenv/execenv.go:329 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the workspaces root before preparing the execution environment."],"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"}