abiosoft/colima · error

error saving settings: %w

Error message

error saving settings: %w

What it means

Raised by limaVM.Set when 'sudo mkdir -p <dir-of-configFile>' fails inside the guest before writing the VM-side settings/config file (the lima config store used for keys like the kubernetes ConfigKey). The wrapped error is the guest command's stderr/exit status, so the VM being unreachable or sudo misbehaving is the usual root cause.

Source

Thrown at environment/vm/lima/config.go:46

func (l limaVM) Get(key string) string {
	if val, ok := l.getConf()[key]; ok {
		return val
	}

	return ""
}

func (l limaVM) Set(key, value string) error {
	obj := l.getConf()
	obj[key] = value

	b, err := json.Marshal(obj)
	if err != nil {
		return fmt.Errorf("error marshalling settings to json: %w", err)
	}

	if err := l.Run("sudo", "mkdir", "-p", filepath.Dir(configFile)); err != nil {
		return fmt.Errorf("error saving settings: %w", err)
	}

	if err := l.Write(configFile, b); err != nil {
		return fmt.Errorf("error saving settings: %w", err)
	}

	return nil
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Confirm the VM is up and healthy: 'colima status', 'colima ssh -- true'; restart it ('colima stop && colima start') so Set re-runs.
  2. Check guest disk and filesystem: 'colima ssh -- df -h' and 'colima ssh -- sudo touch /var/lib/colima/test' to probe writability.
  3. If limactl itself is the failure (check the wrapped err string), reinstall/relaunch lima (brew reinstall lima) and retry.
  4. Recreate the VM when the guest is unrecoverable: 'colima delete -f && colima start' (expect settings reset).
Defensive patterns

Strategy: validation

Validate before calling

// verify the guest is reachable before writing settings
if err := l.Run("true"); err != nil {
    return fmt.Errorf("guest unreachable; start the VM before saving settings: %w", err)
}

Try / catch

if err := l.Run("sudo", "mkdir", "-p", filepath.Dir(configFile)); err != nil {
    if strings.Contains(err.Error(), "not running") || strings.Contains(err.Error(), "exit status 255") {
        return fmt.Errorf("error saving settings (VM not up): %w", err)
    }
    return fmt.Errorf("error saving settings: %w", err)
}

Prevention

When it happens

Trigger: Executing Set(...) while the Lima VM is stopped or still booting (limactl ssh fails); guest SSH broken after an interrupted start; sudo in the guest requiring interaction; guest filesystem read-only or full; limactl missing on the host PATH so the command cannot even launch.

Common situations: 'colima start' races where settings are written before cloud-init finished; VM wedged after host sleep/resume; disk space exhausted by images; partial upgrade of lima leaving limactl shim broken.

Related errors


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