abiosoft/colima · error

cannot copy config to new profile '%s': %w

Error message

cannot copy config to new profile '%s': %w

What it means

Returned by `colima clone` (cmd/clone.go:63) when `mkdir -p` on filepath.Dir(to.LimaInstanceDir()) — the destination's parent directory inside the colima lima home — fails while preparing to copy config. The %s is the destination profile short name, the %w the mkdir error.

Source

Thrown at cmd/clone.go:63

				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)
			}
		}

		{
			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. Fix ownership/permissions of the lima home: `sudo chown -R $(id -un) ~/.colima/_lima`
  2. Remove any regular file occupying the parent path and clean partial destination dirs from failed attempts
  3. Confirm free disk space with `df -h ~` and retry the clone
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight the parent dir of the destination before clone
if err := os.MkdirAll(filepath.Dir(to.LimaInstanceDir()), 0755); err != nil {
    return fmt.Errorf("destination parent not preparable: %w", err)
}

Prevention

When it happens

Trigger: The colima lima home (or the immediate parent of the new instance dir) is not writable, a regular file occupies a path component, or the disk is full. Same failure class as the 'error preparing to copy VM' step but hit at the config stage.

Common situations: Ownership of the lima home changed (root-owned after sudo use); partial clone state left behind by a failed prior attempt; out-of-space home volume.

Related errors


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