{"record":{"id":"2484e4e9927c3576","repo":"lima-vm/lima","slug":"option-list-fields-conflicts-with-option-filte","errorCode":null,"errorMessage":"option --list-fields conflicts with option --filter","messagePattern":"option --list-fields conflicts with option --filter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/list.go","lineNumber":177,"sourceCode":"\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}\n\n\tif err := store.Validate(); err != nil {\n\t\tlogrus.Warnf(\"The directory %#q does not look like a valid Lima directory: %v\", store.Directory(), err)\n\t}\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/list.go#L159-L195","documentation":"--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.","triggerScenarios":"Running `limactl list --list-fields --filter 'name=default'` — len(filter) != 0 with listFields true.","commonSituations":"Attempting to discover which fields exist for a filtered subset; scripts that grew both a discovery flag and a filter flag.","solutions":["Drop --filter when listing fields: `limactl list --list-fields`","If filtering is needed, remove --list-fields and use `limactl list --filter 'name=default' --format json`"],"exampleFix":"// before\nlimactl list --list-fields --filter 'name=default'\n// after\nlimactl list --filter 'name=default' --format json","handlingStrategy":"validation","validationCode":"args := os.Args[1:]\nif slices.Contains(args, \"--list-fields\") && slices.Contains(args, \"--filter\") {\n    args = slices.DeleteFunc(args, func(a string) bool { return strings.HasPrefix(a, \"--filter\") })\n}","typeGuard":null,"tryCatchPattern":"if err := runList(); err != nil {\n    if strings.Contains(err.Error(), \"--list-fields conflicts with --filter\") { /* retry without --filter */ }\n    return err\n}","preventionTips":["Field discovery does not need filtering — call --list-fields plain","Filter only real instance listings"],"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"}