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 err

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Inspect the path: ls -la ~/.lima/_config and fix with sudo chown -R $(whoami) ~/.lima
  2. Remove any regular file blocking the directory creation
  3. Free disk space if the volume is full
  4. 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

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


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/53129c41148edb5c. Report an issue: GitHub.