abiosoft/colima · error

error copying VM config: %w

Error message

error copying VM config: %w

What it means

Returned by `colima clone` (cmd/clone.go:67) when the final external `cp <from.LimaInstanceDir()> <to.LimaInstanceDir()>` fails while copying the VM/config directory. Note both operands are directories (config/profile.go:68) and the cp is invoked without a recursive flag, so on macOS cp rejects a bare directory source; this hidden command is experimental and this step is fragile.

Source

Thrown at cmd/clone.go:67

			).Run(); err != nil {
				return fmt.Errorf("error copying VM: %w", err)
			}
		}

		{
			logrus.Info("copying config...")
			// verify source config exists
			if _, err := os.Stat(from.LimaInstanceDir()); err != nil {
				return fmt.Errorf("config missing for colima profile '%s': %w", from.ShortName, err)
			}

			// ensure destination config directory
			if err := cli.Command("mkdir", "-p", filepath.Dir(to.LimaInstanceDir())).Run(); err != nil {
				return fmt.Errorf("cannot copy config to new profile '%s': %w", to.ShortName, err)
			}

			if err := cli.Command("cp", from.LimaInstanceDir(), to.LimaInstanceDir()).Run(); err != nil {
				return fmt.Errorf("error copying VM config: %w", err)
			}
		}

		logrus.Info("clone successful")
		logrus.Infof("run `colima start %s` to start the newly cloned profile", to.ShortName)
		return nil
	},
}

func init() {
	root.Cmd().AddCommand(cloneCmd)
	cloneCmd.Hidden = true

}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Prefer supported flows instead of the hidden clone: recreate the profile with `colima start` and the same flags, or file an issue upstream
  2. If copying manually, use recursion: `cp -R <from-instance-dir>/ <to-instance-dir>/`
  3. Check the inner cp error (%w) for permissions or disk causes and fix those
  4. Clean the partial destination profile (`colima delete -f <new-profile>`) before any retry

Example fix

# before (fragile hidden command)
colima clone foo bar   # error copying VM config: ...

# after (manual, recursive)
cp -R ~/.colima/_lima/foo/ ~/.colima/_lima/bar/
colima start -p bar
Defensive patterns

Strategy: validation

Validate before calling

// Prefer supported recreation over the hidden clone; if scripting it, verify
// the destination dir is empty and copy recursively yourself
if entries, _ := os.ReadDir(to.LimaInstanceDir()); len(entries) > 0 {
    return fmt.Errorf("destination not empty; clean it before clone")
}

Prevention

When it happens

Trigger: cp fails because a directory is copied without -R ('cp: ... is a directory (not copied)'), the destination dir already contains the files staged in the earlier step, permissions/disk issues, or the source changed mid-clone.

Common situations: Any use of the hidden clone command on a normal profile layout — the final cp semantics make it likely to fail independent of environment; cloneCmd is registered with Hidden = true precisely because it is not production-ready.

Related errors


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