{"record":{"id":"e44bd552f83fccfc","repo":"multica-ai/multica","slug":"stat-s-copy-s-w","errorCode":null,"errorMessage":"stat %s copy %s: %w","messagePattern":"stat (.+?) copy (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/codex_home.go","lineNumber":1027,"sourceCode":"// identity-checked by openVerifiedCodexHomeRoot.\nfunc materialiseInCodexHome(codexHome, relPath, src, key string) error {\n\troot, err := openVerifiedCodexHomeRoot(codexHome, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer root.Close()\n\n\tif dir := filepath.Dir(relPath); dir != \".\" {\n\t\tif err := root.MkdirAll(dir, 0o755); err != nil {\n\t\t\treturn fmt.Errorf(\"create %s directory %s: %w\", key, dir, err)\n\t\t}\n\t}\n\tif _, err := root.Lstat(relPath); err == nil {\n\t\tif err := root.Remove(relPath); err != nil {\n\t\t\treturn fmt.Errorf(\"remove stale %s copy %s: %w\", key, relPath, err)\n\t\t}\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"stat %s copy %s: %w\", key, relPath, err)\n\t}\n\n\tin, err := os.Open(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"open %s %s: %w\", key, src, err)\n\t}\n\tdefer in.Close()\n\n\tout, err := root.OpenFile(relPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"create %s copy %s: %w\", key, relPath, err)\n\t}\n\tdefer out.Close()\n\n\tif _, err := io.Copy(out, in); err != nil {\n\t\treturn fmt.Errorf(\"copy %s %s to %s: %w\", key, src, relPath, err)\n\t}\n\t// Close explicitly so a deferred write-back failure cannot be swallowed; the","sourceCodeStart":1009,"sourceCodeEnd":1045,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/codex_home.go#L1009-L1045","documentation":"materialiseInCodexHome Lstats the destination relPath to decide whether a stale-copy removal is needed. Any error other than not-exist is surfaced here — e.g. permission denied on a parent directory, or I/O failure — because the copy cannot proceed safely without knowing the destination state.","triggerScenarios":"A parent of relPath denies search permission; filesystem I/O error during Lstat; dangling path components with wrong types.","commonSituations":"Task home with user-mangled permissions from a prior task; failing disk or volume.","solutions":["Fix permissions on the intermediate directories under the task home","Recreate the task home","Check volume/filesystem health if I/O errors appear in daemon logs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Lstat(filepath.Join(codexHome, relPath)); err != nil && !errors.Is(err, fs.ErrNotExist) {\n\treturn fmt.Errorf(\"destination path unprobeable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify search permissions on intermediate directories","Recreate the home on persistent Lstat failures"],"tags":["filesystem","codex-home","permissions"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}