{"record":{"id":"782ce21bd082d032","repo":"jdx/mise","slug":"task-list-options-cannot-be-used-with-subcommands","errorCode":null,"errorMessage":"task list options cannot be used with subcommands","messagePattern":"task list options cannot be used with subcommands","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/cli/tasks/mod.rs","lineNumber":62,"sourceCode":"            Self::Deps(cmd) => cmd.run().await,\n            Self::Edit(cmd) => cmd.run().await,\n            Self::Graph(cmd) => cmd.run().await,\n            Self::Info(cmd) => cmd.run().await,\n            Self::Ls(cmd) => cmd.run().await,\n            Self::Run(cmd) => (*cmd).run().await,\n            Self::Validate(cmd) => cmd.run().await,\n        }\n    }\n}\n\nimpl Tasks {\n    pub async fn run(self) -> Result<()> {\n        let Self { command, task, ls } = self;\n        let cmd = match command {\n            Some(Commands::Ls(cmd)) => Commands::Ls(ls.merge(cmd)?),\n            Some(cmd) => {\n                if ls.has_options() {\n                    bail!(\"task list options cannot be used with subcommands\");\n                }\n                cmd\n            }\n            None => match task {\n                Some(task) => {\n                    if ls.has_non_json_options() {\n                        bail!(\"task list options cannot be used with task info\");\n                    }\n                    Commands::Info(info::TasksInfo {\n                        task,\n                        json: ls.json,\n                    })\n                }\n                None => Commands::Ls(ls),\n            },\n        };\n\n        cmd.run().await","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/tasks/mod.rs#L44-L80","documentation":"The `mise tasks` command accepts list options inline (e.g. `mise tasks --json`) plus subcommands (`ls`, `validate`, ...). Inline list options are only legal with the implicit/explicit `ls` behavior; when another subcommand is given, Tasks::run (src/cli/tasks/mod.rs:62) bails because listing flags have no meaning for e.g. `validate`.","triggerScenarios":"`mise tasks --json validate`, `mise tasks --hidden run ...` style invocations — any `mise tasks <list-option> <subcommand>` where the subcommand is not `ls`.","commonSituations":"Refactoring a script from `mise tasks --json` to add a subcommand and leaving flags in place; muscle memory putting global-looking flags before the subcommand.","solutions":["For listing, use the dedicated subcommand: `mise tasks ls --json` (inline options merge into ls)","For the subcommand, drop the list options: `mise tasks validate`","Check `mise tasks --help` for which options belong to which subcommand"],"exampleFix":"# before\n$ mise tasks --json validate\n# error: task list options cannot be used with subcommands\n\n# after\n$ mise tasks ls --json      # listing\n$ mise tasks validate       # validation","handlingStrategy":"validation","validationCode":"# put flags with the subcommand they belong to\nmise tasks ls --json      # listing flags on ls\nmise tasks validate       # no listing flags on other subcommands","typeGuard":null,"tryCatchPattern":"mise tasks \"$@\" || { echo 'list options only combine with `tasks ls`' >&2; exit 1; }","preventionTips":["Standardize scripts on the explicit `mise tasks ls <flags>` form","Never place tasks-ls options before a subcommand other than ls"],"tags":["mise","tasks","cli-flags","subcommands","flag-conflict"],"backgroundTag":"mutually-exclusive-cli-flags","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}