{"record":{"id":"12d5171a24c8012f","repo":"multica-ai/multica","slug":"prepare-task-temp-dir-w","errorCode":null,"errorMessage":"prepare task temp dir: %w","messagePattern":"prepare task temp dir: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/daemon.go","lineNumber":6635,"sourceCode":"\t\t\t}\n\t\t\t// In worktree mode a failed cleanup is NOT survivable: Finalize is\n\t\t\t// about to `git add -A`, so whatever the cleanup could not remove\n\t\t\t// gets committed and delivered as the task's branch — a diff whose\n\t\t\t// content is Multica's own runtime files, which is precisely what\n\t\t\t// this mode promises never to produce. Tell Finalize to abort\n\t\t\t// instead, so nothing is committed and the worktree is kept for\n\t\t\t// inspection. (In place there is no commit and no branch, so a\n\t\t\t// cleanup failure stays a warning: the leftover files are visible\n\t\t\t// in the user's own tree and removable by hand.)\n\t\t\tif cleanupErr != nil && env.LocalWorktree != nil {\n\t\t\t\tenv.LocalWorktree.AbortWithReason(fmt.Errorf(\n\t\t\t\t\t\"could not remove the runtime's own files from the worktree before committing: %w\", cleanupErr))\n\t\t\t}\n\t\t}()\n\t}\n\ttaskTempDir, err := ensureTaskTempDir(env.RootDir, task.WorkspaceID, task.ID)\n\tif err != nil {\n\t\treturn TaskResult{}, fmt.Errorf(\"prepare task temp dir: %w\", err)\n\t}\n\tdefer func() {\n\t\tif cerr := os.RemoveAll(taskTempDir); cerr != nil {\n\t\t\ttaskLog.Warn(\"task temp dir cleanup failed\", \"path\", taskTempDir, \"error\", cerr)\n\t\t}\n\t}()\n\n\t// Issue #3999 race A: now that env.WorkDir is on disk, transition the\n\t// server-side state machine dispatched (or waiting_local_directory) →\n\t// running. Calling StartTask before Prepare/Reuse let any consumer\n\t// that read status==running and resolved\n\t// /multica_workspaces/{ws}/{short-id}/workdir hit FileNotFoundError in\n\t// the microsecond window before os.MkdirAll ran.\n\t//\n\t// On error we return early so handleTask's existing FailTask +\n\t// taskfailure.Classify path records the failure with the same\n\t// \"start task failed: <…>\" string and the same failure_reason\n\t// taxonomy as before — see MUL-2946 for the classifier contract.","sourceCodeStart":6617,"sourceCodeEnd":6653,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/daemon.go#L6617-L6653","documentation":"Error \"prepare task temp dir: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/daemon/daemon.go:6635 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and permissions for the temp directory."],"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-15T17:31:12.345Z"}