{"record":{"id":"a98fdb46b69561b4","repo":"lima-vm/lima","slug":"option-json-conflicts-with-option-format","errorCode":null,"errorMessage":"option --json conflicts with option --format","messagePattern":"option --json conflicts with option --format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/list.go","lineNumber":162,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tyq, err := cmd.Flags().GetStringArray(\"yq\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilter, err := cmd.Flags().GetStringArray(\"filter\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif jsonFormat {\n\t\tformat = \"json\"\n\t}\n\n\t// conflicts\n\tif jsonFormat && cmd.Flags().Changed(\"format\") {\n\t\treturn errors.New(\"option --json conflicts with option --format\")\n\t}\n\tif listFields && cmd.Flags().Changed(\"format\") {\n\t\treturn errors.New(\"option --list-fields conflicts with option --format\")\n\t}\n\tif len(yq) != 0 {\n\t\tif cmd.Flags().Changed(\"format\") && format != \"json\" && format != \"yaml\" {\n\t\t\treturn errors.New(\"option --yq only works with --format json or yaml\")\n\t\t}\n\t\tif listFields {\n\t\t\treturn errors.New(\"option --list-fields conflicts with option --yq\")\n\t\t}\n\t}\n\tif len(filter) != 0 {\n\t\tif listFields {\n\t\t\treturn errors.New(\"option --list-fields conflicts with option --filter\")\n\t\t}\n\t}\n","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/list.go#L144-L180","documentation":"`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.","triggerScenarios":"Running `limactl list --json --format yaml` (or any --format value) — jsonFormat is true and cmd.Flags().Changed(\"format\") is also true.","commonSituations":"Combining flags from older docs (--json) with newer formatting examples (--format); shell scripts accumulating flags over time; copy-pasting two examples together.","solutions":["Drop --json and use only `--format json`","Or keep --json and remove the --format flag","Audit scripts for both flags appearing together"],"exampleFix":"// before\nlimactl list --json --format yaml\n// after\nlimactl list --format yaml","handlingStrategy":"validation","validationCode":"args := os.Args[1:]\nif slices.Contains(args, \"--json\") && slices.Contains(args, \"--format\") {\n    args = slices.DeleteFunc(args, func(a string) bool { return a == \"--json\" })\n}","typeGuard":null,"tryCatchPattern":"if err := runList(); err != nil {\n    if strings.Contains(err.Error(), \"--json conflicts with --format\") { /* retry without --json */ }\n    return err\n}","preventionTips":["Standardize on --format json in scripts; avoid legacy --json","Never combine --json with --format","Lint shell scripts for duplicate format flags"],"tags":["cli","flags","lima"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}