abiosoft/colima · warning

error persisting kubernetes settings: %w

Error message

error persisting kubernetes settings: %w

What it means

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.

Source

Thrown at app/app.go:153

			return fmt.Errorf("error provisioning %s: %w", cont.Name(), err)
		}
		log.Println("starting ...")
		if err := cont.Start(ctx); err != nil {
			return fmt.Errorf("error starting %s: %w", cont.Name(), err)
		}
	}

	// run ready provision scripts
	c.runProvisionScripts(conf, config.ProvisionModeReady)

	// persist the current runtime
	if err := c.setRuntime(conf.Runtime); err != nil {
		log.Error(fmt.Errorf("error persisting runtime settings: %w", err))
	}

	// persist the kubernetes config
	if err := c.setKubernetes(conf.Kubernetes); err != nil {
		log.Error(fmt.Errorf("error persisting kubernetes settings: %w", err))
	}

	log.Println("done")

	if err := generateSSHConfig(conf.SSHConfig); err != nil {
		log.Trace("error generating ssh_config: %w", err)
	}
	return nil
}

func (c colimaApp) runProvisionScripts(conf config.Config, mode string) {
	var failed bool
	for _, s := range conf.Provision {
		if s.Mode != mode {
			continue
		}
		if err := c.guest.Run("sh", "-c", s.Script); err != nil {
			failed = true

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Repair permissions on the colima config directory (`sudo chown -R $(whoami) ~/.colima`)
  2. Free home disk space and re-run start so the settings persist
  3. Avoid concurrent colima invocations on one profile
  4. Verify persistence afterwards via `colima status --json` or the instance config
Defensive patterns

Strategy: fallback

Validate before calling

// ensure the config store is writable before start (same store holds kubernetes settings)
home, _ := os.UserHomeDir()
configDir := filepath.Join(home, ".colima")
if fi, err := os.Stat(configDir); err == nil && fi.Mode().Perm()&0200 == 0 {
    // repair ownership before starting with --kubernetes
}

Try / catch

// non-fatal by design; after `colima start --kubernetes`, verify the cluster context exists
// kubectl config get-contexts | grep colima

Prevention

When it happens

Trigger: Same class as setRuntime: read-only or root-owned ~/.colima, full home disk, or a concurrent process mutating the store while it is written.

Common situations: `colima start --kubernetes` run with sudo once leaving root-owned files; full home volume; two colima commands against the same profile simultaneously.

Related errors


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