{"record":{"id":"402d2c3485f1b827","repo":"abiosoft/colima","slug":"error-persisting-kubernetes-settings-w","errorCode":null,"errorMessage":"error persisting kubernetes settings: %w","messagePattern":"error persisting kubernetes settings: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/app.go","lineNumber":153,"sourceCode":"\t\t\treturn fmt.Errorf(\"error provisioning %s: %w\", cont.Name(), err)\n\t\t}\n\t\tlog.Println(\"starting ...\")\n\t\tif err := cont.Start(ctx); err != nil {\n\t\t\treturn fmt.Errorf(\"error starting %s: %w\", cont.Name(), err)\n\t\t}\n\t}\n\n\t// run ready provision scripts\n\tc.runProvisionScripts(conf, config.ProvisionModeReady)\n\n\t// persist the current runtime\n\tif err := c.setRuntime(conf.Runtime); err != nil {\n\t\tlog.Error(fmt.Errorf(\"error persisting runtime settings: %w\", err))\n\t}\n\n\t// persist the kubernetes config\n\tif err := c.setKubernetes(conf.Kubernetes); err != nil {\n\t\tlog.Error(fmt.Errorf(\"error persisting kubernetes settings: %w\", err))\n\t}\n\n\tlog.Println(\"done\")\n\n\tif err := generateSSHConfig(conf.SSHConfig); err != nil {\n\t\tlog.Trace(\"error generating ssh_config: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (c colimaApp) runProvisionScripts(conf config.Config, mode string) {\n\tvar failed bool\n\tfor _, s := range conf.Provision {\n\t\tif s.Mode != mode {\n\t\t\tcontinue\n\t\t}\n\t\tif err := c.guest.Run(\"sh\", \"-c\", s.Script); err != nil {\n\t\t\tfailed = true","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/app/app.go#L135-L171","documentation":"Twin of the runtime-persist error: after start, c.setKubernetes fails to save the kubernetes settings into the config store and the error is only logged, not returned. The start itself succeeded, but the kubernetes configuration may be lost for subsequent commands.","triggerScenarios":"Same class as setRuntime: read-only or root-owned ~/.colima, full home disk, or a concurrent process mutating the store while it is written.","commonSituations":"`colima start --kubernetes` run with sudo once leaving root-owned files; full home volume; two colima commands against the same profile simultaneously.","solutions":["Repair permissions on the colima config directory (`sudo chown -R $(whoami) ~/.colima`)","Free home disk space and re-run start so the settings persist","Avoid concurrent colima invocations on one profile","Verify persistence afterwards via `colima status --json` or the instance config"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// ensure the config store is writable before start (same store holds kubernetes settings)\nhome, _ := os.UserHomeDir()\nconfigDir := filepath.Join(home, \".colima\")\nif fi, err := os.Stat(configDir); err == nil && fi.Mode().Perm()&0200 == 0 {\n    // repair ownership before starting with --kubernetes\n}","typeGuard":null,"tryCatchPattern":"// non-fatal by design; after `colima start --kubernetes`, verify the cluster context exists\n// kubectl config get-contexts | grep colima","preventionTips":["Avoid sudo with colima so config files stay user-owned","Verify kubernetes persistence with `colima status --json` after start","Do not race two colima commands on one profile"],"tags":["config","filesystem","permissions","kubernetes"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}