lima-vm/lima · error

cannot use both --tty and --yes flags at the same time

Error message

cannot use both --tty and --yes flags at the same time

What it means

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.

Source

Thrown at cmd/limactl/main.go:164

			return errors.New("limactl is running under rosetta, please reinstall lima with native arch")
		}

		// Make sure either $HOME or $LIMA_HOME is defined, so we don't need
		// to check for errors later
		dir, err := dirnames.LimaDir()
		if err != nil {
			return err
		}
		nfs, err := fsutil.IsNFS(dir)
		if err != nil {
			return err
		}
		if nfs {
			logrus.Warn("LIMA_HOME should not be on an NFS mount")
		}

		if cmd.Flags().Changed("yes") && cmd.Flags().Changed("tty") {
			return errors.New("cannot use both --tty and --yes flags at the same time")
		}

		if cmd.Flags().Changed("yes") {
			switch cmd.Name() {
			case "clone", "edit", "rename":
				logrus.Warn("--yes flag is deprecated (--tty=false is still supported and works in the same way. Also consider using --start)")
			}

			// Sets the value of the yesValue flag by using the yes flag.
			yesValue, _ := cmd.Flags().GetBool("yes")
			if yesValue {
				// Sets to the default value false
				err := cmd.Flags().Set("tty", "false")
				if err != nil {
					return err
				}
			}
		}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Remove --yes and keep only --tty=false (or nothing, for interactive)
  2. Set LIMA_SHELL/env or alias `limactl --tty=false` once instead of combining flags
  3. Update automation scripts that still pass the deprecated --yes flag

Example fix

// before
limactl --tty --yes delete myvm
// after
limactl --tty=false delete myvm
Defensive patterns

Strategy: validation

Validate before calling

[ -z "$LIMA_YES" ] && [ -z "$LIMA_TTY" ] || { [ -n "$LIMA_YES" ] && [ -n "$LIMA_TTY" ] && echo "pick --tty or --yes, not both" && exit 1; }

Try / catch

if err := cmd.Execute(); err != nil {
	if strings.Contains(err.Error(), "--tty and --yes") {
		fmt.Fprintln(os.Stderr, "use --tty=false instead of --yes")
		os.Exit(2)
	}
	os.Exit(1)
}

Prevention

When it happens

Trigger: `limactl --tty --yes <cmd>` or `limactl --yes --tty=false <cmd>` — any invocation where both flags are explicitly Changed, including scripts exporting both for convenience.

Common situations: Scripts that accumulated both flags over Lima versions (--yes was deprecated in favor of --tty); CI templates copying old examples; shell aliases merging flags.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/b72dded009729ecf. Report an issue: GitHub.