{"record":{"id":"28f1667283b2b356","repo":"abiosoft/colima","slug":"colima-profile-s-already-exists-delete-with-c","errorCode":null,"errorMessage":"colima profile '%s' already exists, delete with `colima delete %s` and try again","messagePattern":"colima profile '(.+?)' already exists, delete with `colima delete (.+?)` and try again","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/clone.go","lineNumber":34,"sourceCode":"var cloneCmd = &cobra.Command{\n\tUse:   \"clone <profile> <new-profile>\",\n\tShort: \"clone Colima profile\",\n\tLong:  `Clone the Colima profile.`,\n\tArgs:  cobra.ExactArgs(2),\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tfrom := config.ProfileFromName(args[0])\n\t\tto := config.ProfileFromName(args[1])\n\n\t\tlogrus.Infof(\"preparing to clone %s...\", from.DisplayName)\n\t\t{\n\t\t\t// verify source profile exists\n\t\t\tif stat, err := os.Stat(from.LimaInstanceDir()); err != nil || !stat.IsDir() {\n\t\t\t\treturn fmt.Errorf(\"colima profile '%s' does not exist\", from.ShortName)\n\t\t\t}\n\n\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}","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/clone.go#L16-L52","documentation":"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.","triggerScenarios":"Running `colima clone foo bar` when a Lima instance directory for 'bar' already exists (profile previously created, even if stopped or broken).","commonSituations":"Re-running a clone after a partial failure; destination name colliding with an existing stopped profile; forgetting a profile created earlier during experimentation.","solutions":["Pick a different destination profile name","Or remove the existing one first: `colima delete bar` (add -f if stopped) as the error message suggests, then rerun the clone","Verify with `colima list` afterwards that only the intended profiles remain"],"exampleFix":"# before\ncolima clone foo bar   # already exists\n\n# after\ncolima delete -f bar\ncolima clone foo bar","handlingStrategy":"validation","validationCode":"// Verify the destination name is free before cloning\nto := config.ProfileFromName(dstName)\nif stat, err := os.Stat(to.LimaInstanceDir()); err == nil && stat.IsDir() {\n    return fmt.Errorf(\"destination '%s' taken; choose another name or run `colima delete -f %s`\", dstName, dstName)\n}","typeGuard":null,"tryCatchPattern":"if err := runClone(src, dst); err != nil {\n    if strings.Contains(err.Error(), \"already exists\") {\n        // either delete the destination profile first or pick a new name\n    }\n    return err\n}","preventionTips":["Adopt a naming convention (e.g. -dev, -ci suffixes) to avoid collisions","Check `colima list` for existing names before choosing a clone target","Clean up experimental profiles promptly with `colima delete`"],"tags":["clone","profile","validation","colima"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}