{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/tasks/mod.rs","lineNumber":61,"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(crate) 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":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/tasks/mod.rs#L43-L79","documentation":"`mise tasks` accepts either list options applied directly to an implicit `ls`, or a subcommand with its own arguments — but not both. When a subcommand other than Ls is given and the pre-subcommand `ls` options carry any options (`has_options()` true), run() bails because list options have no meaning for e.g. `mise tasks run`/`info`.","triggerScenarios":"Invoking something like `mise tasks --json run build` or `mise tasks --extended info mytask` — list flags (--json, --extended, --usage, --name-only, etc.) precede a non-ls subcommand.","commonSituations":"Users placing `--json` before the subcommand intending it to apply to the subcommand's output; scripted invocations that unconditionally prepend ls flags; confusion between `mise tasks ls --json` and `mise tasks run ...`.","solutions":["Move list options after `ls`: use `mise tasks ls --json` instead of `mise tasks --json ls`-style pre-flags","Drop the list flags entirely when invoking a non-ls subcommand like `run`, `info`, or `deps`","If the subcommand supports its own output flags (e.g. `mise tasks run --json` if available), pass them after the subcommand, not before"],"exampleFix":"// before\nmise tasks --json run build\n// error: task list options cannot be used with subcommands\n// after\nmise tasks run build             # or: mise tasks ls --json","handlingStrategy":"validation","validationCode":"# pass list flags only to `ls`: mise tasks ls --json, never mise tasks --json <subcmd>","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Place list options after the `ls` subcommand, not before other subcommands","Don't prepend --json/--extended/--usage to `tasks run`/`tasks info`","Check `mise tasks --help` to see which flags belong to the implicit ls vs subcommands"],"tags":["cli","tasks","flags","argument-parsing"],"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"}