multica-ai/multica · error · worktreePreservedError

local_directory worktree: %w

Error message

local_directory worktree: %w

What it means

Error "local_directory worktree: %w" thrown in multica-ai/multica.

Source

Thrown at server/internal/daemon/daemon.go:6559

			if finalizeErr == nil {
				return
			}
			// The agent's changes could not be committed, so Finalize kept the
			// worktree instead of deleting them. Fail the task: a "completed"
			// task whose branch is missing the work reads as success, and the
			// user would never learn the changes are sitting in an env root the
			// GC reclaims on a timer.
			//
			// Wrapped in worktreePreservedError so the cancel path can
			// recognise it: a cancelled task discards its result and error, but
			// THIS error names the preserved worktree holding the agent's work
			// and must ride the cancel ack instead of vanishing into a log.
			// Joined rather than replacing an earlier failure — that one is
			// usually the more useful primary cause, but the preserved path
			// must not be displaced by it.
			taskLog.Error("local_directory: worktree finalize could not persist the agent's changes",
				"error", finalizeErr, "preserved_path", outcome.PreservedPath)
			wrapped := &worktreePreservedError{err: fmt.Errorf("local_directory worktree: %w", finalizeErr)}
			if returnErr == nil {
				returnErr = wrapped
			} else {
				returnErr = errors.Join(returnErr, wrapped)
			}
		}()
	}
	// Workdir is preserved for reuse by future tasks on the same (agent,
	// issue) pair in cloud mode; the work_dir path is stored in DB on task
	// completion and passed back via PriorWorkDir on the next claim, so
	// rewriting the marker block in place is the right behavior.
	//
	// In local_directory mode the workdir is the user's own repo, reuse is
	// already disabled above (see localAssignment == nil), and the brief
	// would otherwise live on inside the user's repository — a subsequent
	// manual `claude` / `codex` run in that directory would pick
	// up stale Multica instructions (issue id, trigger comment id, reply
	// rules) and start acting on the previous task's context. Excise the

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Inspect the wrapped error from the worktree setup and retry.

When it happens

Trigger: Thrown at server/internal/daemon/daemon.go:6559 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/430bf0a14d7d3ee2. Report an issue: GitHub.