{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/tasks/ls.rs","lineNumber":111,"sourceCode":"\nimpl TasksLs {\n    pub(super) 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(super) fn has_options(&self) -> bool {\n        self.json || self.has_non_json_options()\n    }\n\n    pub(super) 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":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/tasks/ls.rs#L93-L129","documentation":"When merging the `mise tasks ls` options provided before a subcommand with the subcommand's own options, merge() enforces mutual exclusivity: `--name-only` prints bare task names and cannot be combined with output modes that add structure or metadata (`--json`, `--extended`, `--usage`).","triggerScenarios":"Invoking `mise tasks ls --name-only ... --json` (or --extended / --usage), including cases where the flags come from different positions that get merged in `Commands::Ls(ls.merge(cmd))` — the combined state has name_only set alongside one of the structured-output flags.","commonSituations":"Shell aliases that already inject --name-only while the user adds --json; scripts concatenating flag sets; users assuming --name-only merely filters --json output.","solutions":["Remove `--name-only` when you need --json, --extended, or --usage output (structured modes already name tasks)","Drop the structured flag if you only want a plain list of names, keeping --name-only alone","Fix the alias/wrapper that pre-sets --name-only so it doesn't collide with flags you pass explicitly"],"exampleFix":"// before\nmise tasks ls --name-only --json\n// error: --name-only cannot be used with --json, --extended, or --usage\n// after\nmise tasks ls --json          # or: mise tasks ls --name-only","handlingStrategy":"validation","validationCode":"# shellcheck disable=SC2086\n[[ \" $flags \" != *\" --name-only \"* ]] || ! [[ \" $flags \" =~ --(json|extended|usage) ]] && mise tasks ls $flags","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine --name-only with --json/--extended/--usage","Audit shell aliases that inject --name-only into tasks ls","Choose one output mode per invocation"],"tags":["cli","tasks","flags","conflicting-options"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}