multica-ai/multica · error
close temp config file
Error message
close temp config file: %w
What it means
The temp file's Close() returned an error after a successful write. On local filesystems this is rare; on NFS or FUSE mounts close can surface deferred write errors (data could not be flushed). The temp file is removed and the save aborted, leaving the previous config untouched.
Solutions
- Move the config storage to a local filesystem or fix the network mount
- Check system logs for the underlying I/O error
- Retry after remounting the filesystem read-write and healthy
- Verify quota limits if the mount enforces per-user quotas at flush
Defensive patterns
Strategy: retry
Try / catch
if err := cli.SaveCLIConfig(cfg); err != nil && strings.Contains(err.Error(), "close temp config file") {
// likely network-filesystem flush failure; retry after remount or move root to local disk
} Prevention
- Keep the config root on a local filesystem rather than NFS/FUSE
- Check mount health before scheduled config-heavy operations
- Old config survives a failed close — safe to retry
When it happens
Trigger: Saving the config onto an NFS/FUSE mount where flushing at close fails; a filesystem returning EIO at flush time after a device error.
Common situations: MULTICA_TASK_CONFIG_ROOT on network storage; laptops with failing disks; fuse overlay filesystems with quota enforcement at flush.
Related errors
- read -- -file
- write temp config file
- API error
- attachment too large for inline preview
- chmod temp config file
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/f8aa7ab1b9dd6c0b.
Report an issue: GitHub.
Appendix: source
Thrown at server/internal/cli/config.go:366
data, err := json.MarshalIndent(cfg, "", " ")
if err != nil {
return fmt.Errorf("encode CLI config: %w", err)
}
// Write to a temp file in the same directory, then rename for atomicity.
tmp, err := os.CreateTemp(dir, ".config-*.json.tmp")
if err != nil {
return fmt.Errorf("create temp config file: %w", err)
}
tmpPath := tmp.Name()
if _, err := tmp.Write(append(data, '\n')); err != nil {
tmp.Close()
os.Remove(tmpPath)
return fmt.Errorf("write temp config file: %w", err)
}
if err := tmp.Close(); err != nil {
os.Remove(tmpPath)
return fmt.Errorf("close temp config file: %w", err)
}
if err := os.Chmod(tmpPath, 0o600); err != nil {
os.Remove(tmpPath)
return fmt.Errorf("chmod temp config file: %w", err)
}
if err := os.Rename(tmpPath, path); err != nil {
os.Remove(tmpPath)
return fmt.Errorf("rename config file: %w", err)
}
return nil
}
View on GitHub (pinned to 2c0912b6ec)