{"record":{"id":"53129c41148edb5c","repo":"abiosoft/colima","slug":"error-creating-lima-config-directory-w","errorCode":null,"errorMessage":"error creating Lima config directory: %w","messagePattern":"error creating Lima config directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/network.go","lineNumber":47,"sourceCode":"\nfunc (l *limaVM) writeNetworkFile(conf config.Config) error {\n\tnetworkFile := limautil.NetworkFile()\n\n\t// use custom gateway address\n\tgatewayAddress := conf.Network.GatewayAddress\n\tif gatewayAddress != nil {\n\t\tdefaultLimaNetworkConfig.Networks.UserV2.Gateway = gatewayAddress\n\t}\n\n\t// if there are no running instances, clear network directory\n\tif instances, err := limautil.RunningInstances(); err == nil && len(instances) == 0 {\n\t\tif err := os.RemoveAll(limautil.NetworkAssetsDirectory()); err != nil {\n\t\t\tlogrus.Warnln(fmt.Errorf(\"could not clear network assets directory: %w\", err))\n\t\t}\n\t}\n\n\tif err := os.MkdirAll(filepath.Dir(networkFile), 0755); err != nil {\n\t\treturn fmt.Errorf(\"error creating Lima config directory: %w\", err)\n\t}\n\n\tnetworkFileMarshalled, err := yaml.Marshal(&defaultLimaNetworkConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshalling Lima network config file: %w\", err)\n\t}\n\n\tif err := os.WriteFile(networkFile, networkFileMarshalled, 0755); err != nil {\n\t\treturn fmt.Errorf(\"error writing Lima network config file: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (l *limaVM) replicateHostAddresses(conf config.Config) error {\n\tif !conf.Network.Address && conf.Network.HostAddresses {\n\t\tfor _, ip := range util.HostIPAddresses() {\n\t\t\tif err := l.RunQuiet(\"sudo\", \"ip\", \"address\", \"add\", ip.String()+\"/24\", \"dev\", \"lo\"); err != nil {\n\t\t\t\treturn err","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/network.go#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"~/.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.","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"],"exampleFix":"# before: mkdir denied (root-owned ~/.lima/_config)\ncolima start   # error creating Lima config directory\n# after\nsudo chown -R $(whoami) ~/.lima && colima start","handlingStrategy":"validation","validationCode":"// pre-flight: writable Lima config root\nfunc limaConfigRootWritable() error {\n    dir := filepath.Join(config.Dir Lima(), \"_config\") // Lima's config root\n    return os.MkdirAll(dir, 0755) // cheap idempotent probe\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["network","filesystem","permissions","startup"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}