multica-ai/multica · error

execenv: create worktree workdir

Error message

execenv: create worktree workdir %s: %w

What it means

Wraps os.MkdirAll failure ensuring the worktree workdir path exists — the resource may point at a subdirectory containing only ignored files, which git does not materialize in the worktree. Without the dir the agent has no cwd.

Solutions

  1. Check disk space and permissions for the worktree workdir.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/internal/daemon/execenv/execenv.go:415 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/af4b626c1362a637. Report an issue: GitHub.

Appendix: source

Thrown at server/internal/daemon/execenv/execenv.go:415

		wtParams.TaskID = params.TaskID
		var err error
		localWorktree, err = PrepareLocalWorktree(wtParams, logger)
		if err != nil {
			return nil, err
		}
		defer func() {
			if prepareSucceeded {
				return
			}
			// Safe to discard unconditionally: no agent has run yet, so the
			// worktree holds only what Prepare itself put there.
			localWorktree.Discard(logger)
		}()
		workDir = localWorktree.WorkDir
		// The resource may point at a subdirectory that holds only ignored
		// files, in which case git doesn't materialise it in the worktree.
		if err := os.MkdirAll(workDir, 0o755); err != nil {
			return nil, fmt.Errorf("execenv: create worktree workdir %s: %w", workDir, err)
		}
	}

	env := &Environment{
		RootDir:           envRoot,
		WorkDir:           workDir,
		LocalDirectory:    params.LocalWorkDir != "",
		LocalWorktree:     localWorktree,
		MulticaConfigRoot: multicaConfigRoot,
		logger:            logger,
	}

	// Write context files into workdir (skills go to provider-native paths).
	// Track every file/dir we create in a manifest so CleanupSidecars can
	// roll a local_directory workdir back to its pre-Prepare state. Cloud
	// tasks don't need the manifest (the GC loop wipes envRoot wholesale),
	// but we always write one — it's cheap, keeps Prepare/Reuse symmetric,
	// and avoids a conditional that would silently disable cleanup if the

View on GitHub (pinned to 2c0912b6ec)