warpdotdev/warp · error

unexpected argument '--harness' found

Error message

unexpected argument '--harness' found

What it means

Thrown in run_agent for AgentCommand::Run (mod.rs:280): a non-default `--harness` value parsed (the arg is hidden, default Harness::Oz), but FeatureFlag::AgentHarness is disabled, so delegating to an external harness CLI (claude/codex/gemini/opencode) is rejected with clap-mimicking 'unexpected argument' wording.

Source

Thrown at app/src/ai/agent_sdk/mod.rs:280

    ctx: &mut AppContext,
    global_options: GlobalOptions,
    command: AgentCommand,
) -> anyhow::Result<()> {
    match command {
        AgentCommand::Run(args) => {
            if args.environment.is_some() && !FeatureFlag::CloudEnvironments.is_enabled() {
                return Err(anyhow::anyhow!("unexpected argument '--environment' found"));
            }
            if args.conversation.is_some() && !FeatureFlag::CloudConversations.is_enabled() {
                return Err(anyhow::anyhow!(
                    "unexpected argument '--conversation' found"
                ));
            }
            if args.skill.is_some() && !FeatureFlag::OzPlatformSkills.is_enabled() {
                return Err(anyhow::anyhow!("unexpected argument '--skill' found"));
            }
            if args.harness != Harness::Oz && !FeatureFlag::AgentHarness.is_enabled() {
                return Err(anyhow::anyhow!("unexpected argument '--harness' found"));
            }
            if args.harness == Harness::OpenCode {
                return Err(anyhow::anyhow!(
                    "The opencode harness is only supported for local child agent launches."
                ));
            }

            let server_api = ServerApiProvider::handle(ctx).as_ref(ctx).get_ai_client();

            // Start the agent driver runner, which will handle the rest of the setup steps
            // (managing both sync and async steps) as well as triggering the driver.
            let runner = ctx.add_singleton_model(|_| AgentDriverRunner);
            runner.update(ctx, move |_, ctx| {
                let spawner = ctx.spawner();
                ctx.spawn(
                    AgentDriverRunner::setup_and_run_driver(
                        spawner,
                        args,

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Omit `--harness` to use the default Warp (oz) agent
  2. Use a build/account where AgentHarness is enabled, or update the CLI
  3. As a Warp developer, override the flag or add FeatureFlag::AgentHarness to DOGFOOD_FLAGS and rebuild

Example fix

# before
$ oz agent run --harness claude "refactor module"
Error: unexpected argument '--harness' found

# after
$ oz agent run "refactor module"
Defensive patterns

Strategy: validation

Validate before calling

if args.harness != Harness::Oz {
    anyhow::ensure!(
        FeatureFlag::AgentHarness.is_enabled(),
        "--harness requires AgentHarness"
    );
}
if args.harness == Harness::OpenCode {
    anyhow::bail!("opencode is only supported for local child agent launches");
}

Type guard

pub fn harness_arg_ok(args: &AgentRunArgs) -> bool {
    args.harness == Harness::Oz
        || (FeatureFlag::AgentHarness.is_enabled() && args.harness != Harness::OpenCode)
}

Try / catch

match run_agent(ctx, opts, cmd) {
    Err(e) if e.to_string().contains("unexpected argument '--harness'") => {
        // harness delegation gated; rerun with default oz harness
    }
    result => result?,
}

Prevention

When it happens

Trigger: Running `agent run --harness claude|codex|gemini|opencode ...` where FeatureFlag::AgentHarness.is_enabled() == false. The default oz harness never triggers this; any explicit non-Oz value does.

Common situations: Handing an agent run to the claude or codex CLI on a gated build; CI reusing dogfood invocations; builds where external-harness delegation has not shipped.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/850a0a2f2f649d55. Report an issue: GitHub.