warpdotdev/warp · error · anyhow::Error

Agent driver dropped while starting Claude message bridge

Error message

Agent driver dropped while starting Claude message bridge

What it means

Returned by the Claude parent-bridge start when ModelSpawner::spawn(...).await errors — the AgentDriver model was dropped before the spawned task that launches run_parent_bridge_forever could execute. The message bridge (streaming Claude messages to the Warp server) therefore never started.

Source

Thrown at app/src/ai/agent_sdk/driver/harness/claude_code/parent_bridge.rs:197

        let state_dir = self.state_dir.clone();
        let task = foreground
            .spawn(move |_, ctx| {
                ctx.spawn(
                    async move {
                        if let Err(err) =
                            run_parent_bridge_forever(server_api, run_id, state_dir.clone()).await
                        {
                            log::warn!(
                                "Claude message bridge stopped for {}: {err:#}",
                                state_dir.display()
                            );
                        }
                    },
                    |_, _, _| {},
                )
            })
            .await
            .map_err(|_| anyhow!("Agent driver dropped while starting Claude message bridge"))?;
        *self.runtime.lock() = Some(MessageBridgeRuntime { task });
        Ok(())
    }

    pub(super) async fn handle_session_update(&self, server_api: Arc<ServerApi>) -> Result<()> {
        if !self.state_dir.exists() {
            return Ok(());
        }
        let hydrator = self.hydrator(server_api);
        let _guard = self.state_lock.lock().await;
        acknowledge_parent_bridge_hook_output(&hydrator, &self.state_dir).await?;
        prepare_parent_bridge_hook_output(
            &hydrator,
            &self.state_dir,
            parent_bridge_max_context_chars(),
        )
        .await
    }

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Retry starting the agent session once — if the drop was a startup race, a fresh session starts the bridge cleanly.
  2. Check logs for why the AgentDriver was dropped (session crash, harness error) and fix that root cause first.
  3. If it recurs, report a lifecycle race between bridge start and driver teardown with the surrounding logs.

Example fix

// before
start_result.await?; // aborts session setup on transient spawn drop

// after (one retry on dropped-driver)
if start_result.await.is_err() {
    log::warn!("bridge start raced driver teardown; retrying");
    // re-invoke the bridge start once before surfacing an error
}
Defensive patterns

Strategy: try-catch

Validate before calling

if foreground.is_dropped() {
    anyhow::bail!("agent driver gone; restart the session instead of starting the bridge");
}

Try / catch

if let Err(err) = bridge.start(server_api).await {
    if err.to_string().contains("Agent driver dropped while starting Claude message bridge") {
        // session lifecycle race: recreate the session rather than retrying the bridge on a dead driver
    } else { return Err(err); }
}

Prevention

When it happens

Trigger: Starting the parent bridge for a Claude-harness session while the AgentDriver entity is torn down concurrently — session crash/kill between spawn and run, app shutdown dropping entities, or a double-start race where the first teardown invalidates the second spawn.

Common situations: Session dies right at startup; app quit racing session setup; driver model released by an error path while bridge setup was still queued. Consequence: claude runs but its messages are not mirrored to the conversation.

Related errors


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