lima-vm/lima · error

option --list-fields conflicts with option --filter

Error message

option --list-fields conflicts with option --filter

What it means

--filter selects which instances to display, which presupposes instance output — but --list-fields only prints the schema (field names). listAction rejects the pair because there is nothing for the filter to apply to.

Source

Thrown at cmd/limactl/list.go:177

	// conflicts
	if jsonFormat && cmd.Flags().Changed("format") {
		return errors.New("option --json conflicts with option --format")
	}
	if listFields && cmd.Flags().Changed("format") {
		return errors.New("option --list-fields conflicts with option --format")
	}
	if len(yq) != 0 {
		if cmd.Flags().Changed("format") && format != "json" && format != "yaml" {
			return errors.New("option --yq only works with --format json or yaml")
		}
		if listFields {
			return errors.New("option --list-fields conflicts with option --yq")
		}
	}
	if len(filter) != 0 {
		if listFields {
			return errors.New("option --list-fields conflicts with option --filter")
		}
	}

	if quiet && format != "table" {
		return errors.New("option --quiet can only be used with '--format table'")
	}

	if listFields {
		names := fieldNames()
		slices.Sort(names)
		fmt.Fprintln(cmd.OutOrStdout(), strings.Join(names, "\n"))
		return nil
	}

	if err := store.Validate(); err != nil {
		logrus.Warnf("The directory %#q does not look like a valid Lima directory: %v", store.Directory(), err)
	}

View on GitHub (pinned to dd909d0973)

Solutions

  1. Drop --filter when listing fields: `limactl list --list-fields`
  2. If filtering is needed, remove --list-fields and use `limactl list --filter 'name=default' --format json`

Example fix

// before
limactl list --list-fields --filter 'name=default'
// after
limactl list --filter 'name=default' --format json
Defensive patterns

Strategy: validation

Validate before calling

args := os.Args[1:]
if slices.Contains(args, "--list-fields") && slices.Contains(args, "--filter") {
    args = slices.DeleteFunc(args, func(a string) bool { return strings.HasPrefix(a, "--filter") })
}

Try / catch

if err := runList(); err != nil {
    if strings.Contains(err.Error(), "--list-fields conflicts with --filter") { /* retry without --filter */ }
    return err
}

Prevention

When it happens

Trigger: Running `limactl list --list-fields --filter 'name=default'` — len(filter) != 0 with listFields true.

Common situations: Attempting to discover which fields exist for a filtered subset; scripts that grew both a discovery flag and a filter flag.

Related errors


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