zellij-org/zellij · error

flags '--build' and '--test' are mutually exclusive!

Error message

flags '--build' and '--test' are mutually exclusive!

What it means

--build and --test select mutually exclusive modes of `ci e2e` (build the E2E binary vs run the tests against it). Supplying both is rejected upfront by the flag-parsing match arms.

Source

Thrown at xtask/src/ci.rs:29

};
use xshell::{cmd, Shell};

pub fn main(sh: &Shell, flags: flags::Ci) -> anyhow::Result<()> {
    let err_context = "failed to run CI task";

    match flags.subcommand {
        CiCmd::E2e(E2e {
            build: false,
            test: false,
            ..
        }) => Err(anyhow::anyhow!(
            "either '--build' or '--test' must be provided!"
        )),
        CiCmd::E2e(E2e {
            build: true,
            test: true,
            ..
        }) => Err(anyhow::anyhow!(
            "flags '--build' and '--test' are mutually exclusive!"
        )),
        CiCmd::E2e(E2e {
            build: true,
            test: false,
            ..
        }) => e2e_build(sh),
        CiCmd::E2e(E2e {
            build: false,
            test: true,
            args,
        }) => e2e_test(sh, args),
        CiCmd::Cross(Cross { triple, no_web }) => cross_compile(sh, &triple, no_web),
        CiCmd::BuildRelease(BuildRelease { no_web }) => build_release(sh, no_web),
    }
    .context(err_context)
}

View on GitHub (pinned to 98a0837077)

Solutions

  1. Split into two invocations: `cargo xtask ci e2e --build && cargo xtask ci e2e --test`
  2. Pass exactly one of the two flags

Example fix

# before
cargo xtask ci e2e --build --test

# after
cargo xtask ci e2e --build && cargo xtask ci e2e --test
Defensive patterns

Strategy: validation

Validate before calling

if [[ "$BUILD" == "1" && "$TEST" == "1" ]]; then
  echo "--build and --test are mutually exclusive; run them sequentially"; exit 2
fi

Type guard

fn e2e_flags_valid(build: bool, test: bool) -> bool {
    build ^ test
}

Prevention

When it happens

Trigger: Running `cargo xtask ci e2e --build --test`.

Common situations: Scripts trying to do build+test in one invocation; stale wrappers assuming a combined flag exists.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/ce4d195d97a71073. Report an issue: GitHub.