abiosoft/colima · error
error writing store file: %w
Error message
error writing store file: %w
What it means
os.WriteFile of the marshalled store failed; %w carries the raw OS error. In practice: permission denied when the store file or directory is not writable (classic sudo-mixed-ownership), ENOSPC on a full home partition, or the parent directory disappearing between load and save.
Source
Thrown at store/store.go:46
return s, fmt.Errorf("cannot read store file: %w", err)
}
if err := json.Unmarshal(b, &s); err != nil {
return s, fmt.Errorf("error unmarshaling store file: %w", err)
}
return s, nil
}
// save persists the store.
func save(s Store) error {
b, err := json.MarshalIndent(s, "", " ")
if err != nil {
return fmt.Errorf("error marshaling store: %w", err)
}
if err := os.WriteFile(storeFile(), b, 0o644); err != nil {
return fmt.Errorf("error writing store file: %w", err)
}
return nil
}
// Set provides an easy way to set a value in the store.
func Set(f func(*Store)) error {
s, err := Load()
if err != nil {
logrus.Debug("error loading store: %w", err)
}
f(&s)
if err := save(s); err != nil {
return fmt.Errorf("error saving store: %w", err)
}
View on GitHub (pinned to c3a5f9184d)
Solutions
- Fix ownership of the colima config/store directory: chown -R $(id -u):$(id -g) <dir>
- Free space on the volume holding the store (df -h) — VM images and models are the usual consumers
- Ensure the store's parent directory exists, then retry the operation
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the store path is writable before mutating state
func storeWritable(p string) bool {
if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil {
return false
}
f, err := os.OpenFile(p, os.O_WRONLY|os.O_CREATE, 0o644)
if err != nil {
return false
}
_ = f.Close()
return true
} Try / catch
var perr *fs.PathError
if errors.As(err, &perr) {
switch {
case errors.Is(perr.Err, fs.ErrPermission):
// fix ownership of the store dir
case errors.Is(perr.Err, fs.ErrNotExist):
// recreate the parent directory, then retry
}
} Prevention
- Never mix sudo and non-sudo colima runs
- Watch home-volume disk usage when pulling multi-GB models
- Write stores atomically (temp file + rename) to avoid corrupt partials
When it happens
Trigger: Store path or its directory owned by root after a sudo colima run; home partition out of space; store directory deleted concurrently with the write.
Common situations: Alternating sudo and regular colima invocations; disk exhaustion from VM disks and pulled AI models.
Related errors
- error saving provisioning state: %w
- error reading ssh config: %w
- cannot make dir: %w
- error saving store: %w
- error persisting runtime settings: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/620da123d44b4ee5.
Report an issue: GitHub.