abiosoft/colima · error

error deleting configs: %w

Error message

error deleting configs: %w

What it means

After the VM teardown, colima removes its own profile configuration via configmanager.Teardown; failure is returned, so `colima delete` exits with an error even though the VM itself is already gone. Only the colima config files remain.

Source

Thrown at app/app.go:282

		for _, cont := range containers {
			log := log.WithField("context", cont.Name())
			log.Println("deleting ...")

			if err := cont.Teardown(ctx); err != nil {
				// failure here is not fatal
				log.Warnln(fmt.Errorf("error during teardown of %s: %w", cont.Name(), err))
			}
		}
	}

	// teardown vm
	if err := c.guest.Teardown(ctx); err != nil {
		return fmt.Errorf("error during teardown of vm: %w", err)
	}

	// delete configs
	if err := configmanager.Teardown(); err != nil {
		return fmt.Errorf("error deleting configs: %w", err)
	}

	// delete runtime disk if disk in use and data deletion is requested
	if diskInUse && data {
		log.Println("deleting container data")
		if err := limautil.DeleteDisk(); err != nil {
			return fmt.Errorf("error deleting container data: %w", err)
		}

		if err := store.Reset(); err != nil {
			log.Trace("error resetting store: %w", err)
		}
	}

	log.Println("done")

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

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Fix ownership then re-delete: `sudo chown -R $(whoami) ~/.colima` followed by `colima delete`, or remove the profile dir manually
  2. Close programs holding files under the colima config dir and retry
  3. Confirm the profile is gone with `colima list`
  4. Avoid running colima under sudo so ownership stays consistent
Defensive patterns

Strategy: retry

Validate before calling

// ensure the config dir is user-writable before delete
home, _ := os.UserHomeDir()
configDir := filepath.Join(home, ".colima")
if fi, err := os.Stat(configDir); err == nil && fi.Mode().Perm()&0200 == 0 {
    // chown/chmod first, then delete
}

Try / catch

if err := a.Delete(false, false); err != nil {
    if strings.Contains(err.Error(), "error deleting configs") {
        // the VM is already gone; remove the profile config dir manually and verify with colima list
    }
}

Prevention

When it happens

Trigger: `colima delete` when files under the colima config directory (~/.colima/<profile> and friends) cannot be removed: root-owned files from earlier sudo runs, a read-only mount, or files open in another program.

Common situations: Mixed-ownership ~/.colima after using sudo; config dir on a synced/read-only filesystem; editor or IDE holding a config file open during delete.

Related errors


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