abiosoft/colima · error
error writing Lima network config file: %w
Error message
error writing Lima network config file: %w
What it means
Error from the Lima network setup when os.WriteFile cannot write the marshalled YAML to the Lima network config file (created with mode 0755). Directory creation and marshalling succeeded; the final write failed.
Source
Thrown at environment/vm/lima/network.go:56
// if there are no running instances, clear network directory
if instances, err := limautil.RunningInstances(); err == nil && len(instances) == 0 {
if err := os.RemoveAll(limautil.NetworkAssetsDirectory()); err != nil {
logrus.Warnln(fmt.Errorf("could not clear network assets directory: %w", err))
}
}
if err := os.MkdirAll(filepath.Dir(networkFile), 0755); err != nil {
return fmt.Errorf("error creating Lima config directory: %w", err)
}
networkFileMarshalled, err := yaml.Marshal(&defaultLimaNetworkConfig)
if err != nil {
return fmt.Errorf("error marshalling Lima network config file: %w", err)
}
if err := os.WriteFile(networkFile, networkFileMarshalled, 0755); err != nil {
return fmt.Errorf("error writing Lima network config file: %w", err)
}
return nil
}
func (l *limaVM) replicateHostAddresses(conf config.Config) error {
if !conf.Network.Address && conf.Network.HostAddresses {
for _, ip := range util.HostIPAddresses() {
if err := l.RunQuiet("sudo", "ip", "address", "add", ip.String()+"/24", "dev", "lo"); err != nil {
return err
}
}
}
return nil
}
func (l *limaVM) removeHostAddresses() {
conf, _ := configmanager.LoadInstance()
if !conf.Network.Address && conf.Network.HostAddresses {View on GitHub (pinned to c3a5f9184d)
Solutions
- Check and fix file ownership: sudo chown $(whoami) ~/.lima/_config/networks/default.yaml (path per your Lima layout)
- Verify the volume is writable and has space: df -h ~
- Temporarily disable/allowlist overzealous file scanners for ~/.lima
- Retry 'colima start'
Example fix
# before: write denied sudo chown -R root ~/.lima # earlier mistake colima start # error writing Lima network config file # after sudo chown -R $(whoami) ~/.lima && colima start
Defensive patterns
Strategy: validation
Validate before calling
// probe writability of the target file/dir
func canWriteNetworkFile(networkFile string) error {
if err := os.MkdirAll(filepath.Dir(networkFile), 0755); err != nil { return err }
return os.WriteFile(networkFile+".probe", nil, 0644)
} Prevention
- Check ownership of existing network YAML files after any sudo incident
- Exclude ~/.lima from backup/AV locks on managed machines
When it happens
Trigger: Existing network config file owned by another user/root, read-only host filesystem, disk full, or an external process (antivirus/backup) holding the file with an exclusive lock at write time.
Common situations: ~/.lima/_config/networks/default.yaml made root-owned by prior sudo use; macOS disk full; enterprise endpoint protection locking files under ~/.lima during 'colima start'.
Related errors
- error modifying %s: %w
- error creating Lima config directory: %w
- error persisting runtime settings: %w
- error persisting kubernetes settings: %w
- error deleting configs: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/aaebf9671b84c1f7.
Report an issue: GitHub.