lima-vm/lima · error
option --json conflicts with option --format
Error message
option --json conflicts with option --format
What it means
`limactl list` treats --json as shorthand for '--format json', so passing both --json and an explicit --format is ambiguous and rejected. listAction performs this conflict check before producing any output.
Source
Thrown at cmd/limactl/list.go:162
if err != nil {
return err
}
yq, err := cmd.Flags().GetStringArray("yq")
if err != nil {
return err
}
filter, err := cmd.Flags().GetStringArray("filter")
if err != nil {
return err
}
if jsonFormat {
format = "json"
}
// 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")
}
}
View on GitHub (pinned to dd909d0973)
Solutions
- Drop --json and use only `--format json`
- Or keep --json and remove the --format flag
- Audit scripts for both flags appearing together
Example fix
// before limactl list --json --format yaml // after limactl list --format yaml
Defensive patterns
Strategy: validation
Validate before calling
args := os.Args[1:]
if slices.Contains(args, "--json") && slices.Contains(args, "--format") {
args = slices.DeleteFunc(args, func(a string) bool { return a == "--json" })
} Try / catch
if err := runList(); err != nil {
if strings.Contains(err.Error(), "--json conflicts with --format") { /* retry without --json */ }
return err
} Prevention
- Standardize on --format json in scripts; avoid legacy --json
- Never combine --json with --format
- Lint shell scripts for duplicate format flags
When it happens
Trigger: Running `limactl list --json --format yaml` (or any --format value) — jsonFormat is true and cmd.Flags().Changed("format") is also true.
Common situations: Combining flags from older docs (--json) with newer formatting examples (--format); shell scripts accumulating flags over time; copy-pasting two examples together.
Related errors
- option --list-fields conflicts with option --format
- option --yq only works with --format json or yaml
- option --list-fields conflicts with option --yq
- option --list-fields conflicts with option --filter
- option --quiet can only be used with '--format table'
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/a98fdb46b69561b4.
Report an issue: GitHub.