jdx/mise · error · eyre::Report

task list options cannot be used with subcommands

Error message

task list options cannot be used with subcommands

What it means

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`.

Source

Thrown at src/cli/tasks/mod.rs:62

            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 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().await

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. For listing, use the dedicated subcommand: `mise tasks ls --json` (inline options merge into ls)
  2. For the subcommand, drop the list options: `mise tasks validate`
  3. Check `mise tasks --help` for which options belong to which subcommand

Example fix

# before
$ mise tasks --json validate
# error: task list options cannot be used with subcommands

# after
$ mise tasks ls --json      # listing
$ mise tasks validate       # validation
Defensive patterns

Strategy: validation

Validate before calling

# put flags with the subcommand they belong to
mise tasks ls --json      # listing flags on ls
mise tasks validate       # no listing flags on other subcommands

Try / catch

mise tasks "$@" || { echo 'list options only combine with `tasks ls`' >&2; exit 1; }

Prevention

When it happens

Trigger: `mise tasks --json validate`, `mise tasks --hidden run ...` style invocations — any `mise tasks <list-option> <subcommand>` where the subcommand is not `ls`.

Common situations: 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.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/782ce21bd082d032. Report an issue: GitHub.