{"record":{"id":"9b9eb49e4c16f380","repo":"lima-vm/lima","slug":"option-list-fields-conflicts-with-option-forma","errorCode":null,"errorMessage":"option --list-fields conflicts with option --format","messagePattern":"option --list-fields conflicts with option --format","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/list.go","lineNumber":165,"sourceCode":"\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\n\tif quiet && format != \"table\" {\n\t\treturn errors.New(\"option --quiet can only be used with '--format table'\")\n\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/list.go#L147-L183","documentation":"--list-fields prints only the available field names, which is incompatible with an explicit --format that controls instance output rendering. listAction rejects the combination since output can only serve one purpose.","triggerScenarios":"Running `limactl list --list-fields --format json` (or any --format) — listFields is true and the format flag was explicitly set.","commonSituations":"Trying to get field names in a machine-readable format for scripting; combining a discovery step with a formatting step in one call.","solutions":["Run `limactl list --list-fields` alone to enumerate fields","Use `--format json` in a separate call when you need formatted instance data"],"exampleFix":"// before\nlimactl list --list-fields --format json\n// after\nlimactl list --list-fields\nlimactl list --format json","handlingStrategy":"validation","validationCode":"if slices.Contains(os.Args, \"--list-fields\") && slices.Contains(os.Args, \"--format\") {\n    os.Args = slices.DeleteFunc(os.Args, func(a string) bool { return strings.HasPrefix(a, \"--format\") })\n}","typeGuard":null,"tryCatchPattern":"if err := runList(); err != nil {\n    if strings.Contains(err.Error(), \"--list-fields conflicts with --format\") { /* run two separate commands */ }\n    return err\n}","preventionTips":["Treat --list-fields as a standalone discovery command","Never add format flags to discovery calls"],"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"}