{"record":{"id":"430bf0a14d7d3ee2","repo":"multica-ai/multica","slug":"local-directory-worktree-w","errorCode":null,"errorMessage":"local_directory worktree: %w","messagePattern":"local_directory worktree: %w","errorType":"exception","errorClass":"worktreePreservedError","httpStatus":null,"severity":"error","filePath":"server/internal/daemon/daemon.go","lineNumber":6559,"sourceCode":"\t\t\tif finalizeErr == nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// The agent's changes could not be committed, so Finalize kept the\n\t\t\t// worktree instead of deleting them. Fail the task: a \"completed\"\n\t\t\t// task whose branch is missing the work reads as success, and the\n\t\t\t// user would never learn the changes are sitting in an env root the\n\t\t\t// GC reclaims on a timer.\n\t\t\t//\n\t\t\t// Wrapped in worktreePreservedError so the cancel path can\n\t\t\t// recognise it: a cancelled task discards its result and error, but\n\t\t\t// THIS error names the preserved worktree holding the agent's work\n\t\t\t// and must ride the cancel ack instead of vanishing into a log.\n\t\t\t// Joined rather than replacing an earlier failure — that one is\n\t\t\t// usually the more useful primary cause, but the preserved path\n\t\t\t// must not be displaced by it.\n\t\t\ttaskLog.Error(\"local_directory: worktree finalize could not persist the agent's changes\",\n\t\t\t\t\"error\", finalizeErr, \"preserved_path\", outcome.PreservedPath)\n\t\t\twrapped := &worktreePreservedError{err: fmt.Errorf(\"local_directory worktree: %w\", finalizeErr)}\n\t\t\tif returnErr == nil {\n\t\t\t\treturnErr = wrapped\n\t\t\t} else {\n\t\t\t\treturnErr = errors.Join(returnErr, wrapped)\n\t\t\t}\n\t\t}()\n\t}\n\t// Workdir is preserved for reuse by future tasks on the same (agent,\n\t// issue) pair in cloud mode; the work_dir path is stored in DB on task\n\t// completion and passed back via PriorWorkDir on the next claim, so\n\t// rewriting the marker block in place is the right behavior.\n\t//\n\t// In local_directory mode the workdir is the user's own repo, reuse is\n\t// already disabled above (see localAssignment == nil), and the brief\n\t// would otherwise live on inside the user's repository — a subsequent\n\t// manual `claude` / `codex` run in that directory would pick\n\t// up stale Multica instructions (issue id, trigger comment id, reply\n\t// rules) and start acting on the previous task's context. Excise the","sourceCodeStart":6541,"sourceCodeEnd":6577,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/daemon.go#L6541-L6577","documentation":"Error \"local_directory worktree: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/daemon/daemon.go:6559 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error from the worktree setup and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}