jdx/mise · error

task list options cannot be used with task info

Error message

task list options cannot be used with task info

What it means

`mise tasks` treats a bare task-name argument as an 'info' request. When a task name is given, list-specific options (like --hidden, --no-header, --columns, checked via `ls.has_non_json_options()`) are meaningless and rejected instead of being silently ignored. Only `--json` is forwarded to TasksInfo.

Solutions

  1. Remove the list options when querying a single task: keep only the task name (and optionally --json)
  2. If you want details as JSON, use `mise tasks <task> --json`
  3. Use `mise tasks` (no task name) if you actually wanted the filtered list view

Example fix

// before
mise tasks build --hidden --no-header
// after
mise tasks build
Defensive patterns

Strategy: validation

Validate before calling

const LIST_ONLY_OPTS = ['--hidden','--no-header','--columns'];
function validateTasksCmd(args){
  const hasTask = args.some(a=>!a.startsWith('-'));
  const bad = args.filter(a=>LIST_ONLY_OPTS.some(o=>a.startsWith(o)));
  if (hasTask && bad.length) throw new Error(`list options ${bad.join(' ')} cannot be used with a task name; use --json only`);
}

Type guard

const isListOption = (a: string) => a.startsWith('--') && a !== '--json';
const hasListOptions = (args: string[]) => args.some(isListOption);

Try / catch

try { execSync(`mise tasks ${name} --json`); } catch (e) { if (String(e).includes('task list options')) console.error('drop list flags when querying a single task'); throw e; }

Prevention

When it happens

Trigger: Running `mise tasks <task> --hidden`, `mise tasks <task> --no-header`, or `mise tasks <task> --columns=...` — any non-JSON list option combined with a positional task name.

Common situations: Typing a task name to see details but keeping list-display flags from a previous `mise tasks` invocation in the command line; scripting that appends task names to a template command containing list flags.

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


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/5256ea64df0526e1. Report an issue: GitHub.

Appendix: source

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

        }
    }
}

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

View on GitHub (pinned to 533346cc37)