{"record":{"id":"5230928befbe9b74","repo":"multica-ai/multica","slug":"could-not-remove-the-runtime-s-own-files-from-the","errorCode":null,"errorMessage":"could not remove the runtime's own files from the worktree before committing: %w","messagePattern":"could not remove the runtime's own files from the worktree before committing: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/daemon.go","lineNumber":6628,"sourceCode":"\t\t\t// every other file Prepare placed under WorkDir. Together\n\t\t\t// they round-trip the workdir to its exact pre-task bytes.\n\t\t\tif cerr := execenv.CleanupSidecars(env.RootDir); cerr != nil {\n\t\t\t\tif cleanupErr == nil {\n\t\t\t\t\tcleanupErr = cerr\n\t\t\t\t}\n\t\t\t\td.logger.Warn(\"execenv: cleanup sidecars failed\", \"error\", cerr)\n\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","sourceCodeStart":6610,"sourceCodeEnd":6646,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/daemon.go#L6610-L6646","documentation":"Error \"could not remove the runtime's own files from the worktree before committing: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/daemon/daemon.go:6628 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check worktree permissions; remove the runtime files manually if needed."],"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"}