multica-ai/multica · error
create %s copy %s: %w
Error message
create %s copy %s: %w
What it means
The destination file inside the verified task home is created with root.OpenFile using O_EXCL, so creation fails if the entry already exists after the stale-removal step, if permissions deny, or if an intermediate symlink escapes the root. This is the exclusive-create safeguard that prevents overwriting anything unexpectedly.
Source
Thrown at server/internal/daemon/execenv/codex_home.go:1038
}
}
if _, err := root.Lstat(relPath); err == nil {
if err := root.Remove(relPath); err != nil {
return fmt.Errorf("remove stale %s copy %s: %w", key, relPath, err)
}
} else if !os.IsNotExist(err) {
return fmt.Errorf("stat %s copy %s: %w", key, relPath, err)
}
in, err := os.Open(src)
if err != nil {
return fmt.Errorf("open %s %s: %w", key, src, err)
}
defer in.Close()
out, err := root.OpenFile(relPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644)
if err != nil {
return fmt.Errorf("create %s copy %s: %w", key, relPath, err)
}
defer out.Close()
if _, err := io.Copy(out, in); err != nil {
return fmt.Errorf("copy %s %s to %s: %w", key, src, relPath, err)
}
// Close explicitly so a deferred write-back failure cannot be swallowed; the
// deferred Close then no-ops.
if err := out.Close(); err != nil {
return fmt.Errorf("close %s copy %s: %w", key, relPath, err)
}
return nil
}
// syncCodexModelsCache seeds models_cache.json once for a fresh task home and
// binds it to the shared provider/catalog configuration. Codex can replace the
// task-local cache after startup, so an unchanged binding preserves whatever
// the task last wrote rather than restoring a potentially stale shared copy.View on GitHub (pinned to 2c0912b6ec)
Solutions
- Re-run prepare — the stale-removal step will clear a pre-existing entry
- Ensure the task home directory is writable by the daemon
- Remove any escaping symlink on the destination path
Defensive patterns
Strategy: retry
Try / catch
if err := materialiseInCodexHome(...); err != nil && strings.Contains(err.Error(), "create "+key+" copy") {
err = materialiseInCodexHome(...) // stale-removal step clears the entry
} Prevention
- Avoid concurrent writers to the same config paths in the task home
- Ensure the home directory is writable before prepare
When it happens
Trigger: relPath was recreated between the Remove and the OpenFile; the containing directory is not writable; an escaping symlink sits in the path.
Common situations: Concurrent process writing the same config path; directory permissions changed by prior task.
Related errors
- stat codex home %s: %w
- read attachment %s: %w
- open codex home %s: %w
- stat opened codex home %s: %w
- codex home %s was replaced while opening it; refusing to wri
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/b9209ee264a4689c.
Report an issue: GitHub.