{"record":{"id":"e88876e6dc64f236","repo":"multica-ai/multica","slug":"execenv-write-context-files-w","errorCode":null,"errorMessage":"execenv: write context files: %w","messagePattern":"execenv: write context files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/execenv.go","lineNumber":468,"sourceCode":"\t//\n\t// In place only. Worktree mode discards the whole worktree on failure just\n\t// above, and a cloud envRoot is wiped wholesale by the GC — only the\n\t// local_directory flow writes into a directory that outlives the task and\n\t// belongs to the user, where a leftover marker disables every multica\n\t// command in that directory tree until someone removes it by hand.\n\tif params.LocalWorkDir != \"\" {\n\t\tdefer func() {\n\t\t\tif prepareSucceeded {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := rollBackPreparedSidecars(*manifest); err != nil && logger != nil {\n\t\t\t\tlogger.Warn(\"execenv: roll back sidecars after failed prepare\", \"work_dir\", workDir, \"error\", err)\n\t\t\t}\n\t\t}()\n\t}\n\n\tif err := writeContextFiles(workDir, params.Provider, params.Task, manifest); err != nil {\n\t\treturn nil, fmt.Errorf(\"execenv: write context files: %w\", err)\n\t}\n\n\t// Persist managed-env provenance for non-local issue envs at Prepare time\n\t// (not on completion, where .gc_meta.json is written). A same-issue\n\t// follow-up can be claimed the instant the prior task completes — before\n\t// the prior handler writes .gc_meta.json — so reuse eligibility must be\n\t// provable from an artifact that exists the moment the env is created. Only\n\t// managed (non-local_directory) issue envs get this marker; that is exactly\n\t// the set squad-leader reuse targets (MUL-4886). Non-fatal: a write failure\n\t// only costs the next follow-up its session reuse (it falls back to a fresh\n\t// session), which must never block dispatching this task.\n\tif params.LocalWorkDir == \"\" && params.Task.IssueID != \"\" {\n\t\tif err := WriteManagedEnvProvenance(envRoot, ManagedEnvProvenance{\n\t\t\tWorkspaceID: params.WorkspaceID,\n\t\t\tIssueID:     params.Task.IssueID,\n\t\t\tAgentID:     params.Task.AgentID,\n\t\t}); err != nil && logger != nil {\n\t\t\tlogger.Warn(\"execenv: write managed env provenance failed (non-fatal); a follow-up may start a fresh session\", \"error\", err)","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/execenv.go#L450-L486","documentation":"Error \"execenv: write context files: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/daemon/execenv/execenv.go:468 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check disk space and permissions for the context files."],"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"}