multica-ai/multica · error
stat %s copy %s: %w
Error message
stat %s copy %s: %w
What it means
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.
Source
Thrown at server/internal/daemon/execenv/codex_home.go:1027
// identity-checked by openVerifiedCodexHomeRoot.
func materialiseInCodexHome(codexHome, relPath, src, key string) error {
root, err := openVerifiedCodexHomeRoot(codexHome, key)
if err != nil {
return err
}
defer root.Close()
if dir := filepath.Dir(relPath); dir != "." {
if err := root.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("create %s directory %s: %w", key, dir, err)
}
}
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; theView on GitHub (pinned to 2c0912b6ec)
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
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Lstat(filepath.Join(codexHome, relPath)); err != nil && !errors.Is(err, fs.ErrNotExist) {
return fmt.Errorf("destination path unprobeable: %w", err)
} Prevention
- Verify search permissions on intermediate directories
- Recreate the home on persistent Lstat failures
When it happens
Trigger: A parent of relPath denies search permission; filesystem I/O error during Lstat; dangling path components with wrong types.
Common situations: Task home with user-mangled permissions from a prior task; failing disk or volume.
Related errors
- open codex home %s: %w
- mint PAT: response missing token
- daemon profile is not resolved yet; token sync skipped
- runtime local skill discovery timed out
- runtime local skill import failed
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/e44bd552f83fccfc.
Report an issue: GitHub.