{"record":{"id":"10d81ea29e7f68a7","repo":"abiosoft/colima","slug":"error-copying-vm-w","errorCode":null,"errorMessage":"error copying VM: %w","messagePattern":"error copying VM: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/clone.go","lineNumber":50,"sourceCode":"\t\t\t// verify destination profile does not exists\n\t\t\tif stat, err := os.Stat(to.LimaInstanceDir()); err == nil && stat.IsDir() {\n\t\t\t\treturn fmt.Errorf(\"colima profile '%s' already exists, delete with `colima delete %s` and try again\", to.ShortName, to.ShortName)\n\t\t\t}\n\n\t\t\t// copy source to destination\n\t\t\tlogrus.Info(\"cloning virtual machine...\")\n\t\t\tif err := cli.Command(\"mkdir\", \"-p\", to.LimaInstanceDir()).Run(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error preparing to copy VM: %w\", err)\n\t\t\t}\n\n\t\t\tif err := cli.Command(\"cp\",\n\t\t\t\tfilepath.Join(from.LimaInstanceDir(), \"basedisk\"),\n\t\t\t\tfilepath.Join(from.LimaInstanceDir(), \"diffdisk\"),\n\t\t\t\tfilepath.Join(from.LimaInstanceDir(), \"cidata.iso\"),\n\t\t\t\tfilepath.Join(from.LimaInstanceDir(), \"lima.yaml\"),\n\t\t\t\tto.LimaInstanceDir(),\n\t\t\t).Run(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error copying VM: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tlogrus.Info(\"copying config...\")\n\t\t\t// verify source config exists\n\t\t\tif _, err := os.Stat(from.LimaInstanceDir()); err != nil {\n\t\t\t\treturn fmt.Errorf(\"config missing for colima profile '%s': %w\", from.ShortName, err)\n\t\t\t}\n\n\t\t\t// ensure destination config directory\n\t\t\tif err := cli.Command(\"mkdir\", \"-p\", filepath.Dir(to.LimaInstanceDir())).Run(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot copy config to new profile '%s': %w\", to.ShortName, err)\n\t\t\t}\n\n\t\t\tif err := cli.Command(\"cp\", from.LimaInstanceDir(), to.LimaInstanceDir()).Run(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error copying VM config: %w\", err)\n\t\t\t}","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/clone.go#L32-L68","documentation":"Returned by `colima clone` (cmd/clone.go:50) when the external `cp` of basedisk, diffdisk, cidata.iso and lima.yaml from the source Lima instance dir into the destination fails. The %w carries the cp exit error.","triggerScenarios":"Source files are missing (profile created but never started, so basedisk/diffdisk were never downloaded/created), permissions changed, or the disk filled up — diffdisk can be large (it is the VM's disk image).","commonSituations":"Cloning a profile that exists on disk but was never fully started; cloning while the source VM is running (file busy/changed); destination volume with less free space than the source diffdisk size.","solutions":["Verify the four files exist in the source instance dir: `ls -la ~/.colima/_lima/<src-profile>`","Start the source profile at least once (`colima start -p <src>`) so the disks are created, stop it, then clone","Ensure free disk space on the destination at least the size of the source diffdisk (`df -h ~`)","Clean up the partial destination dir before retrying, then rerun `colima clone`"],"exampleFix":"# before\ncolima clone neverstarted newprofile   # error copying VM: cp basedisk ... exit status 1\n\n# after\ncolima start -p neverstarted && colima stop -p neverstarted\ncolima clone neverstarted newprofile","handlingStrategy":"validation","validationCode":"// Pre-flight: all four VM files must exist in the source instance dir\nfor _, f := range []string{\"basedisk\", \"diffdisk\", \"cidata.iso\", \"lima.yaml\"} {\n    if _, err := os.Stat(filepath.Join(from.LimaInstanceDir(), f)); err != nil {\n        return fmt.Errorf(\"source VM incomplete (missing %s); run `colima start -p %s` once first\", f, from.ShortName)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start a profile at least once before cloning it — never clone a created-but-never-started profile","Clone while the source VM is stopped to avoid copying in-flight disk changes","Compare free space against the source diffdisk size before cloning"],"tags":["clone","disk","files","colima"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}