abiosoft/colima · error
error creating Lima config directory: %w
Error message
error creating Lima config directory: %w
What it means
Error from the Lima network setup when os.MkdirAll cannot create the parent directory of the Lima network config file (the _config/networks directory under the Lima config root). Subsequent steps that write the network YAML cannot proceed, so the error aborts network configuration.
Source
Thrown at environment/vm/lima/network.go:47
func (l *limaVM) writeNetworkFile(conf config.Config) error {
networkFile := limautil.NetworkFile()
// use custom gateway address
gatewayAddress := conf.Network.GatewayAddress
if gatewayAddress != nil {
defaultLimaNetworkConfig.Networks.UserV2.Gateway = gatewayAddress
}
// 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 errView on GitHub (pinned to c3a5f9184d)
Solutions
- Inspect the path: ls -la ~/.lima/_config and fix with sudo chown -R $(whoami) ~/.lima
- Remove any regular file blocking the directory creation
- Free disk space if the volume is full
- Retry 'colima start' after the fix
Example fix
# before: mkdir denied (root-owned ~/.lima/_config) colima start # error creating Lima config directory # after sudo chown -R $(whoami) ~/.lima && colima start
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight: writable Lima config root
func limaConfigRootWritable() error {
dir := filepath.Join(config.Dir Lima(), "_config") // Lima's config root
return os.MkdirAll(dir, 0755) // cheap idempotent probe
} Prevention
- Assert ~/.lima is user-owned in bootstrap scripts
- Avoid read-only home setups (NFS with root_squash, managed macOS volumes) for the Lima config root
When it happens
Trigger: Creating the networks directory fails due to permission denial (dir owned by root/another user), a file existing where the directory should be, or the host filesystem being full/read-only.
Common situations: ~/.lima/_config chowned to root after running limactl/colima under sudo once; a stale regular file at the directory path; macOS disk full; corporate tooling locking ~/.lima.
Related errors
- error preparing vmnet: %w
- error preparing daemon directory: %w
- error writing Lima network config file: %w
- error persisting runtime settings: %w
- error persisting kubernetes settings: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/53129c41148edb5c.
Report an issue: GitHub.