{"record":{"id":"865efbda5bcf62ca","repo":"lima-vm/lima","slug":"option-list-fields-conflicts-with-option-yq","errorCode":null,"errorMessage":"option --list-fields conflicts with option --yq","messagePattern":"option --list-fields conflicts with option --yq","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/list.go","lineNumber":172,"sourceCode":"\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}\n\n\tif listFields {\n\t\tnames := fieldNames()\n\t\tslices.Sort(names)\n\t\tfmt.Fprintln(cmd.OutOrStdout(), strings.Join(names, \"\\n\"))\n\t\treturn nil\n\t}","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/list.go#L154-L190","documentation":"--list-fields only prints field names and produces no instance records, while --yq expects a document to query. Combining them is meaningless, so listAction rejects it whenever both --yq is set and listFields is true.","triggerScenarios":"Running `limactl list --list-fields --yq '.[]'` — len(yq) != 0 and listFields true reaches the conflict branch after the format checks pass.","commonSituations":"Trying to filter the field-name listing with yq; composing flags from separate examples.","solutions":["List fields alone: `limactl list --list-fields`","If you need to query instances with yq, drop --list-fields and use `--format json --yq '...'`"],"exampleFix":"// before\nlimactl list --list-fields --yq '.[]'\n// after\nlimactl list --list-fields","handlingStrategy":"validation","validationCode":"args := os.Args[1:]\nif slices.Contains(args, \"--list-fields\") && slices.Contains(args, \"--yq\") {\n    args = slices.DeleteFunc(args, func(a string) bool { return a == \"--yq\" || a == \"--list-fields\" })\n}","typeGuard":null,"tryCatchPattern":"if err := runList(); err != nil {\n    if strings.Contains(err.Error(), \"--list-fields conflicts with --yq\") { /* split into two calls */ }\n    return err\n}","preventionTips":["Use --list-fields alone","Apply yq only to instance output, not field listings"],"tags":["cli","flags","yq","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"}