{"record":{"id":"ad3a5d59c1ea1a64","repo":"jdx/mise","slug":"name-only-cannot-be-used-with-json-extended","errorCode":null,"errorMessage":"--name-only cannot be used with --json, --extended, or --usage","messagePattern":"--name-only cannot be used with --json, --extended, or --usage","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cli/tasks/ls.rs","lineNumber":109,"sourceCode":"\nimpl TasksLs {\n    pub fn merge(mut self, later: Self) -> Result<Self> {\n        if later.global || later.local {\n            self.global = later.global;\n            self.local = later.local;\n        }\n        self.json |= later.json;\n        self.extended |= later.extended;\n        self.all |= later.all;\n        self.complete |= later.complete;\n        self.hidden |= later.hidden;\n        self.name_only |= later.name_only;\n        self.no_header |= later.no_header;\n        self.sort = later.sort.or(self.sort);\n        self.sort_order = later.sort_order.or(self.sort_order);\n        self.usage |= later.usage;\n        if self.name_only && (self.json || self.extended || self.usage) {\n            bail!(\"--name-only cannot be used with --json, --extended, or --usage\");\n        }\n        Ok(self)\n    }\n\n    pub fn has_options(&self) -> bool {\n        self.json || self.has_non_json_options()\n    }\n\n    pub fn has_non_json_options(&self) -> bool {\n        self.global\n            || self.local\n            || self.extended\n            || self.all\n            || self.complete\n            || self.hidden\n            || self.name_only\n            || self.no_header\n            || self.sort.is_some()","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/tasks/ls.rs#L91-L127","documentation":"`mise tasks ls` rejects `--name-only` combined with `--json`, `--extended`, or `--usage`. --name-only is a minimal output mode that only prints task names; it cannot carry the structured/detail output the other three flags request, so the merged LsOpts validation in src/cli/tasks/ls.rs:109 bails. Note the check also fires via the merge path (`mise tasks --name-only --json ls`).","triggerScenarios":"`mise tasks ls --name-only --json`, `mise tasks ls --name-only --extended`, `mise tasks ls --name-only --usage`, or the same flags split between the inline form and the ls subcommand which get merged before validation.","commonSituations":"Scripts written for --json that later add --name-only for brevity; shell aliases accumulating flags; completion tooling passing multiple format flags.","solutions":["If you want names only: drop the other flags — `mise tasks ls --name-only`","If you want structured output: drop --name-only and post-process — `mise tasks ls --json | jq -r '.[].name'`","Audit shell aliases/wrappers around mise tasks ls for stacked format flags"],"exampleFix":"# before\n$ mise tasks ls --name-only --json\n# error: --name-only cannot be used with --json, --extended, or --usage\n\n# after\n$ mise tasks ls --json | jq -r '.[].name'","handlingStrategy":"validation","validationCode":"# decide the output shape up front instead of stacking format flags\nmode=\"names\"   # or json\n[ \"$mode\" = names ] && mise tasks ls --name-only || mise tasks ls --json","typeGuard":null,"tryCatchPattern":"mise tasks ls --name-only $EXTRA_FLAGS || { echo 'check for conflicting format flags (--json/--extended/--usage)' >&2; exit 1; }","preventionTips":["Treat output-format flags as mutually exclusive by design in wrappers","Prefer one canonical pipeline (`--json | jq`) and derive all other shapes from it"],"tags":["mise","tasks","cli-flags","flag-conflict","output-format"],"backgroundTag":"mutually-exclusive-cli-flags","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}