multica-ai/multica · error
execenv: workspaces root is required
Error message
execenv: workspaces root is required
What it means
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.
Solutions
- Set the workspaces root before preparing the execution environment.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/internal/daemon/execenv/execenv.go:329 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/20f2525d6ec2f655.
Report an issue: GitHub.
Appendix: source
Thrown at server/internal/daemon/execenv/execenv.go:329
logger *slog.Logger // for cleanup logging
}
// PredictRootDir returns the env root path that Prepare would create for the
// given task, without performing any I/O. Callers use this to claim ownership
// of the directory (e.g. against the GC loop) before Prepare/Reuse runs.
func PredictRootDir(workspacesRoot, workspaceID, taskID string) string {
if workspacesRoot == "" || workspaceID == "" || taskID == "" {
return ""
}
return filepath.Join(workspacesRoot, workspaceID, shortID(taskID))
}
// Prepare creates an isolated execution environment for a task.
// The workdir starts empty (no repo checkouts). The agent checks out repos
// on demand via `multica repo checkout <url>`.
func Prepare(params PrepareParams, logger *slog.Logger) (*Environment, error) {
if params.WorkspacesRoot == "" {
return nil, fmt.Errorf("execenv: workspaces root is required")
}
if params.WorkspaceID == "" {
return nil, fmt.Errorf("execenv: workspace ID is required")
}
if params.TaskID == "" {
return nil, fmt.Errorf("execenv: task ID is required")
}
envRoot := filepath.Join(params.WorkspacesRoot, params.WorkspaceID, shortID(params.TaskID))
// Self-heal the root-level daemon marker on every task start so a marker
// removed while the daemon runs is restored before the agent spawns. The
// per-workdir marker written below only covers cwds inside the workdir;
// the root marker keeps the CLI fail-closed guard active for subprocesses
// that lose all MULTICA_* env vars AND escape above the workdir. Non-fatal:
// without it the workdir marker still protects the common case.
if err := EnsureWorkspacesRootMarker(params.WorkspacesRoot); err != nil && logger != nil {
logger.Warn("execenv: workspaces root marker not written; fail-closed guard limited to the task workdir", "error", err)View on GitHub (pinned to 2c0912b6ec)