{"record":{"id":"b72dded009729ecf","repo":"lima-vm/lima","slug":"cannot-use-both-tty-and-yes-flags-at-the-same","errorCode":null,"errorMessage":"cannot use both --tty and --yes flags at the same time","messagePattern":"cannot use both --tty and --yes flags at the same time","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/main.go","lineNumber":164,"sourceCode":"\t\t\treturn errors.New(\"limactl is running under rosetta, please reinstall lima with native arch\")\n\t\t}\n\n\t\t// Make sure either $HOME or $LIMA_HOME is defined, so we don't need\n\t\t// to check for errors later\n\t\tdir, err := dirnames.LimaDir()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnfs, err := fsutil.IsNFS(dir)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif nfs {\n\t\t\tlogrus.Warn(\"LIMA_HOME should not be on an NFS mount\")\n\t\t}\n\n\t\tif cmd.Flags().Changed(\"yes\") && cmd.Flags().Changed(\"tty\") {\n\t\t\treturn errors.New(\"cannot use both --tty and --yes flags at the same time\")\n\t\t}\n\n\t\tif cmd.Flags().Changed(\"yes\") {\n\t\t\tswitch cmd.Name() {\n\t\t\tcase \"clone\", \"edit\", \"rename\":\n\t\t\t\tlogrus.Warn(\"--yes flag is deprecated (--tty=false is still supported and works in the same way. Also consider using --start)\")\n\t\t\t}\n\n\t\t\t// Sets the value of the yesValue flag by using the yes flag.\n\t\t\tyesValue, _ := cmd.Flags().GetBool(\"yes\")\n\t\t\tif yesValue {\n\t\t\t\t// Sets to the default value false\n\t\t\t\terr := cmd.Flags().Set(\"tty\", \"false\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/main.go#L146-L182","documentation":"The global --tty and --yes flags are mutually exclusive: --yes implies non-interactive (deprecated alias for --tty=false), so specifying both is contradictory. The PersistentPreRunE in cmd/limactl/main.go:164 rejects the combination with this error before any subcommand executes.","triggerScenarios":"`limactl --tty --yes <cmd>` or `limactl --yes --tty=false <cmd>` — any invocation where both flags are explicitly Changed, including scripts exporting both for convenience.","commonSituations":"Scripts that accumulated both flags over Lima versions (--yes was deprecated in favor of --tty); CI templates copying old examples; shell aliases merging flags.","solutions":["Remove --yes and keep only --tty=false (or nothing, for interactive)","Set LIMA_SHELL/env or alias `limactl --tty=false` once instead of combining flags","Update automation scripts that still pass the deprecated --yes flag"],"exampleFix":"// before\nlimactl --tty --yes delete myvm\n// after\nlimactl --tty=false delete myvm","handlingStrategy":"validation","validationCode":"[ -z \"$LIMA_YES\" ] && [ -z \"$LIMA_TTY\" ] || { [ -n \"$LIMA_YES\" ] && [ -n \"$LIMA_TTY\" ] && echo \"pick --tty or --yes, not both\" && exit 1; }","typeGuard":null,"tryCatchPattern":"if err := cmd.Execute(); err != nil {\n\tif strings.Contains(err.Error(), \"--tty and --yes\") {\n\t\tfmt.Fprintln(os.Stderr, \"use --tty=false instead of --yes\")\n\t\tos.Exit(2)\n\t}\n\tos.Exit(1)\n}","preventionTips":["Standardize on --tty=false in scripts; treat --yes as deprecated","Search scripts/aliases for both flags set together","Use a single wrapper function to build global flags"],"tags":["cli","flags","interactive"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}