jdx/mise · error
task list options cannot be used with subcommands
Error message
task list options cannot be used with subcommands
What it means
`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`.
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
Example fix
// before mise tasks --json run build // error: task list options cannot be used with subcommands // after mise tasks run build # or: mise tasks ls --json
Defensive patterns
Strategy: validation
Validate before calling
# pass list flags only to `ls`: mise tasks ls --json, never mise tasks --json <subcmd>
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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 ...`.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- --name-only cannot be used with --json, --extended, or…
- a repository preview directory requires a dry run
- cannot encode # as JSON
- --changed does not accept target arguments
- choose --github-relay-repo OWNER/REPO or…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/782ce21bd082d032.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/tasks/mod.rs:61
Self::Deps(cmd) => cmd.run().await,
Self::Edit(cmd) => cmd.run().await,
Self::Graph(cmd) => cmd.run().await,
Self::Info(cmd) => cmd.run().await,
Self::Ls(cmd) => cmd.run().await,
Self::Run(cmd) => (*cmd).run().await,
Self::Validate(cmd) => cmd.run().await,
}
}
}
impl Tasks {
pub(crate) async fn run(self) -> Result<()> {
let Self { command, task, ls } = self;
let cmd = match command {
Some(Commands::Ls(cmd)) => Commands::Ls(ls.merge(cmd)?),
Some(cmd) => {
if ls.has_options() {
bail!("task list options cannot be used with subcommands");
}
cmd
}
None => match task {
Some(task) => {
if ls.has_non_json_options() {
bail!("task list options cannot be used with task info");
}
Commands::Info(info::TasksInfo {
task,
json: ls.json,
})
}
None => Commands::Ls(ls),
},
};
cmd.run().awaitView on GitHub (pinned to 533346cc37)