multica-ai/multica · error
rename config file: %w
Error message
rename config file: %w
What it means
The final atomic step — os.Rename of the temp file over config.json — failed. Common errnos: EXDEV cannot happen (same directory), so in practice this is EACCES/EPERM from directory permissions or a stale handle on Windows systems where the destination is open in another process.
Source
Thrown at server/internal/cli/config.go:374
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)
Solutions
- Fix write permission/ownership on the directory containing config.json
- Close any editors or processes holding the config file open and retry (Windows)
- If config.json somehow became a directory, remove it and retry the save
- Retry once — the temp file from the failed attempt is already cleaned up
Defensive patterns
Strategy: try-catch
Try / catch
if err := cli.SaveCLIConfig(cfg); err != nil && strings.Contains(err.Error(), "rename config file") {
// check directory writability and (on Windows) open handles, then retry
} Prevention
- Ensure the config directory is writable by the saving user
- On Windows, avoid holding config.json open while the CLI may write it
- Rely on the atomic rename semantics: a failure never corrupts the existing file
When it happens
Trigger: SaveCLIConfig when the config directory is not writable by the current user at rename time, or (on Windows) when another process holds config.json open, or when the destination is a directory.
Common situations: Ownership changed by an earlier sudo run; an editor or the daemon holding the config file open on Windows; MULTICA_TASK_CONFIG_ROOT directories chmod'd by a different task walk.
Related errors
- mint PAT: response missing token
- daemon profile is not resolved yet; token sync skipped
- runtime local skill discovery timed out
- runtime local skill import timed out
- runtime local skill import failed
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/0f817d3e3729758f.
Report an issue: GitHub.