{"record":{"id":"972c33f061fff363","repo":"warpdotdev/warp","slug":"the-opencode-harness-is-only-supported-for-local-c","errorCode":null,"errorMessage":"The opencode harness is only supported for local child agent launches.","messagePattern":"The opencode harness is only supported for local child agent launches\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/mod.rs","lineNumber":283,"sourceCode":") -> anyhow::Result<()> {\n    match command {\n        AgentCommand::Run(args) => {\n            if args.environment.is_some() && !FeatureFlag::CloudEnvironments.is_enabled() {\n                return Err(anyhow::anyhow!(\"unexpected argument '--environment' found\"));\n            }\n            if args.conversation.is_some() && !FeatureFlag::CloudConversations.is_enabled() {\n                return Err(anyhow::anyhow!(\n                    \"unexpected argument '--conversation' found\"\n                ));\n            }\n            if args.skill.is_some() && !FeatureFlag::OzPlatformSkills.is_enabled() {\n                return Err(anyhow::anyhow!(\"unexpected argument '--skill' found\"));\n            }\n            if args.harness != Harness::Oz && !FeatureFlag::AgentHarness.is_enabled() {\n                return Err(anyhow::anyhow!(\"unexpected argument '--harness' found\"));\n            }\n            if args.harness == Harness::OpenCode {\n                return Err(anyhow::anyhow!(\n                    \"The opencode harness is only supported for local child agent launches.\"\n                ));\n            }\n\n            let server_api = ServerApiProvider::handle(ctx).as_ref(ctx).get_ai_client();\n\n            // Start the agent driver runner, which will handle the rest of the setup steps\n            // (managing both sync and async steps) as well as triggering the driver.\n            let runner = ctx.add_singleton_model(|_| AgentDriverRunner);\n            runner.update(ctx, move |_, ctx| {\n                let spawner = ctx.spawner();\n                ctx.spawn(\n                    AgentDriverRunner::setup_and_run_driver(\n                        spawner,\n                        args,\n                        server_api,\n                        global_options.output_format,\n                    ),","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/mod.rs#L265-L301","documentation":"Thrown in run_agent for AgentCommand::Run (mod.rs:283): `--harness opencode` is rejected regardless of feature flags, because the opencode harness is only wired up for local child agent launches made by Warp itself, not for user-invoked `agent run`/`run-cloud` sessions. This is a semantic support check, distinct from the AgentHarness flag gate that fires just above it.","triggerScenarios":"Running `agent run --harness opencode ...` (flag on or off - the OpenCode check is unconditional and ordered after the flag gate). The Harness::OpenCode variant parses fine from the CLI enum; the driver path for it simply does not exist here.","commonSituations":"Users assuming all five harness values (oz/claude/opencode/gemini/codex) work everywhere; scripts copied from Warp's internal child-agent tooling; selecting opencode because the CLI is not installed locally.","solutions":["Drop `--harness opencode` and use the default oz harness for CLI-initiated runs","To run opencode, launch it directly or through Warp's local child-agent flow instead of `agent run`","Use `--harness claude`/`codex`/`gemini` if you specifically need an external CLI harness and the AgentHarness flag is enabled"],"exampleFix":"# before\n$ oz agent run --harness opencode \"do a task\"\nError: The opencode harness is only supported for local child agent launches.\n\n# after\n$ oz agent run \"do a task\"","handlingStrategy":"validation","validationCode":"// Reject opencode before invoking the CLI:\nanyhow::ensure!(\n    args.harness != Harness::OpenCode,\n    \"opencode harness cannot be used via agent run; use a local child agent launch\"\n);","typeGuard":"pub fn harness_supported_here(h: Harness) -> bool {\n    h != Harness::OpenCode // for CLI-initiated run/run-cloud paths\n}","tryCatchPattern":"match run_agent(ctx, opts, cmd) {\n    Err(e) if e.to_string().contains(\"opencode harness is only supported\") => {\n        // relaunch without --harness, or drive opencode directly\n    }\n    result => result?,\n}","preventionTips":["Do not assume every Harness enum variant is selectable on every launch path","For opencode, invoke the CLI directly or use Warp's in-app local child agents","Keep a matrix of harness x launch-path support in tooling docs"],"tags":["cli","agent-harness","opencode","rust","warp"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}