abiosoft/colima · error

colima profile '%s' already exists, delete with `colima dele

Error message

colima profile '%s' already exists, delete with `colima delete %s` and try again

What it means

Returned by `colima clone` (cmd/clone.go:34) when os.Stat succeeds on the destination profile's Lima instance directory, i.e. the new-profile name is already taken. The message includes the delete command hint with the profile's short name.

Source

Thrown at cmd/clone.go:34

var cloneCmd = &cobra.Command{
	Use:   "clone <profile> <new-profile>",
	Short: "clone Colima profile",
	Long:  `Clone the Colima profile.`,
	Args:  cobra.ExactArgs(2),
	RunE: func(cmd *cobra.Command, args []string) error {
		from := config.ProfileFromName(args[0])
		to := config.ProfileFromName(args[1])

		logrus.Infof("preparing to clone %s...", from.DisplayName)
		{
			// verify source profile exists
			if stat, err := os.Stat(from.LimaInstanceDir()); err != nil || !stat.IsDir() {
				return fmt.Errorf("colima profile '%s' does not exist", from.ShortName)
			}

			// verify destination profile does not exists
			if stat, err := os.Stat(to.LimaInstanceDir()); err == nil && stat.IsDir() {
				return fmt.Errorf("colima profile '%s' already exists, delete with `colima delete %s` and try again", to.ShortName, to.ShortName)
			}

			// copy source to destination
			logrus.Info("cloning virtual machine...")
			if err := cli.Command("mkdir", "-p", to.LimaInstanceDir()).Run(); err != nil {
				return fmt.Errorf("error preparing to copy VM: %w", err)
			}

			if err := cli.Command("cp",
				filepath.Join(from.LimaInstanceDir(), "basedisk"),
				filepath.Join(from.LimaInstanceDir(), "diffdisk"),
				filepath.Join(from.LimaInstanceDir(), "cidata.iso"),
				filepath.Join(from.LimaInstanceDir(), "lima.yaml"),
				to.LimaInstanceDir(),
			).Run(); err != nil {
				return fmt.Errorf("error copying VM: %w", err)
			}
		}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Pick a different destination profile name
  2. Or remove the existing one first: `colima delete bar` (add -f if stopped) as the error message suggests, then rerun the clone
  3. Verify with `colima list` afterwards that only the intended profiles remain

Example fix

# before
colima clone foo bar   # already exists

# after
colima delete -f bar
colima clone foo bar
Defensive patterns

Strategy: validation

Validate before calling

// Verify the destination name is free before cloning
to := config.ProfileFromName(dstName)
if stat, err := os.Stat(to.LimaInstanceDir()); err == nil && stat.IsDir() {
    return fmt.Errorf("destination '%s' taken; choose another name or run `colima delete -f %s`", dstName, dstName)
}

Try / catch

if err := runClone(src, dst); err != nil {
    if strings.Contains(err.Error(), "already exists") {
        // either delete the destination profile first or pick a new name
    }
    return err
}

Prevention

When it happens

Trigger: Running `colima clone foo bar` when a Lima instance directory for 'bar' already exists (profile previously created, even if stopped or broken).

Common situations: Re-running a clone after a partial failure; destination name colliding with an existing stopped profile; forgetting a profile created earlier during experimentation.

Related errors


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