warpdotdev/warp · error · AgentDriverError

Invalid runtime state - please file a bug report.

Error message

Invalid runtime state - please file a bug report.

What it means

Internal invariant failure while assembling the Task to run: after config merge, neither a base prompt (skill instructions or config `base_prompt`) nor a user prompt exists, so the `(None, None)` match arm returns `AgentDriverError::InvalidRuntimeState`. The message asks for a bug report because a prompt or a skill is normally guaranteed by argument parsing. In practice it almost always means the invocation supplied neither.

Source

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

        .filter(|_| args.harness == Harness::Oz)
        .map(|model_id| common::validate_agent_mode_base_model_id(model_id, ctx))
        .transpose()?;

    // Keep the task config snapshot aligned with the effective model selection.
    merged_config.model_id = model_override.clone().map(|id| id.to_string());

    // Combine base_prompt with user prompt locally.
    let local_prompt = match (merged_config.base_prompt.as_deref(), prompt) {
        (Some(base_prompt), Some(Prompt::PlainText(user_prompt))) => {
            Prompt::PlainText(format!("{base_prompt}\n\n{user_prompt}"))
        }
        (Some(base_prompt), None) => {
            // Skill-only invocation: use skill instructions as the prompt
            Prompt::PlainText(base_prompt.to_string())
        }
        (_, Some(p)) => p.clone(),
        (None, None) => {
            return Err(anyhow::anyhow!(AgentDriverError::InvalidRuntimeState));
        }
    };

    let task = Task {
        prompt: AgentRunPrompt::Local(resolve_prompt(&local_prompt, ctx)?),
        model: model_override,
        profile: args.profile.clone(),
        mcp_specs: runtime_mcp_specs,
        harness: harness_kind(args.harness)?,
    };

    Ok((merged_config, task))
}

/// Build the task for server-side prompt resolution (task_id is set).
/// Only CLI args contribute — no config file merge needed.
fn build_server_side_task(
    args: &RunAgentArgs,

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Pass a user prompt (positional argument or stdin) to `warp agent run`
  2. Add `--skill <name>` so the skill instructions become the base prompt
  3. If calling the SDK programmatically, assert that a prompt or base_prompt exists before building the Task
  4. If both a prompt and a skill were provided and it still fires, follow the message and file a bug with the full command line

Example fix

# before
warp agent run --config ./agent.toml   # no prompt, no skill

# after
warp agent run --config ./agent.toml --skill reviewer
# or: warp agent run "review my PR"
Defensive patterns

Strategy: validation

Validate before calling

// Before building the Task, require something to run
let has_prompt = prompt.as_ref().is_some_and(|p| !p.is_empty());
let has_base = merged_config.base_prompt.as_ref().is_some_and(|p| !p.is_empty());
if !has_prompt && !has_base {
    anyhow::bail!("nothing to run: pass a prompt or --skill");
}

Try / catch

out=$(warp agent run --config "$CONFIG" 2>&1) || { case "$out" in *'Invalid runtime state'*) echo 'no prompt/skill given' >&2; exit 2;; *) echo "$out" >&2; exit 1;; esac; }

Prevention

When it happens

Trigger: Invoking the agent run/task-create flow with no positional/stdin prompt AND no resolved skill AND no `base_prompt` in the merged config — typically from programmatic callers constructing RunAgentArgs by hand, a skill name that fails to resolve, or an empty-string prompt.

Common situations: Scripts piping an empty string as the prompt; a skill name typo so `resolved_skill` is None while the script also passes no prompt; SDK/harness code building args where the prompt field was forgotten.

Related errors


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