jdx/mise · error · eyre::Report

--name-only cannot be used with --json, --extended, or --usa

Error message

--name-only cannot be used with --json, --extended, or --usage

What it means

`mise tasks ls` rejects `--name-only` combined with `--json`, `--extended`, or `--usage`. --name-only is a minimal output mode that only prints task names; it cannot carry the structured/detail output the other three flags request, so the merged LsOpts validation in src/cli/tasks/ls.rs:109 bails. Note the check also fires via the merge path (`mise tasks --name-only --json ls`).

Source

Thrown at src/cli/tasks/ls.rs:109

impl TasksLs {
    pub fn merge(mut self, later: Self) -> Result<Self> {
        if later.global || later.local {
            self.global = later.global;
            self.local = later.local;
        }
        self.json |= later.json;
        self.extended |= later.extended;
        self.all |= later.all;
        self.complete |= later.complete;
        self.hidden |= later.hidden;
        self.name_only |= later.name_only;
        self.no_header |= later.no_header;
        self.sort = later.sort.or(self.sort);
        self.sort_order = later.sort_order.or(self.sort_order);
        self.usage |= later.usage;
        if self.name_only && (self.json || self.extended || self.usage) {
            bail!("--name-only cannot be used with --json, --extended, or --usage");
        }
        Ok(self)
    }

    pub fn has_options(&self) -> bool {
        self.json || self.has_non_json_options()
    }

    pub fn has_non_json_options(&self) -> bool {
        self.global
            || self.local
            || self.extended
            || self.all
            || self.complete
            || self.hidden
            || self.name_only
            || self.no_header
            || self.sort.is_some()

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. If you want names only: drop the other flags — `mise tasks ls --name-only`
  2. If you want structured output: drop --name-only and post-process — `mise tasks ls --json | jq -r '.[].name'`
  3. Audit shell aliases/wrappers around mise tasks ls for stacked format flags

Example fix

# before
$ mise tasks ls --name-only --json
# error: --name-only cannot be used with --json, --extended, or --usage

# after
$ mise tasks ls --json | jq -r '.[].name'
Defensive patterns

Strategy: validation

Validate before calling

# decide the output shape up front instead of stacking format flags
mode="names"   # or json
[ "$mode" = names ] && mise tasks ls --name-only || mise tasks ls --json

Try / catch

mise tasks ls --name-only $EXTRA_FLAGS || { echo 'check for conflicting format flags (--json/--extended/--usage)' >&2; exit 1; }

Prevention

When it happens

Trigger: `mise tasks ls --name-only --json`, `mise tasks ls --name-only --extended`, `mise tasks ls --name-only --usage`, or the same flags split between the inline form and the ls subcommand which get merged before validation.

Common situations: Scripts written for --json that later add --name-only for brevity; shell aliases accumulating flags; completion tooling passing multiple format flags.

Related errors


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