{"record":{"id":"aa9363cda358b161","repo":"warpdotdev/warp","slug":"agent-driver-dropped-while-starting-claude-message","errorCode":null,"errorMessage":"Agent driver dropped while starting Claude message bridge","messagePattern":"Agent driver dropped while starting Claude message bridge","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/driver/harness/claude_code/parent_bridge.rs","lineNumber":197,"sourceCode":"        let state_dir = self.state_dir.clone();\n        let task = foreground\n            .spawn(move |_, ctx| {\n                ctx.spawn(\n                    async move {\n                        if let Err(err) =\n                            run_parent_bridge_forever(server_api, run_id, state_dir.clone()).await\n                        {\n                            log::warn!(\n                                \"Claude message bridge stopped for {}: {err:#}\",\n                                state_dir.display()\n                            );\n                        }\n                    },\n                    |_, _, _| {},\n                )\n            })\n            .await\n            .map_err(|_| anyhow!(\"Agent driver dropped while starting Claude message bridge\"))?;\n        *self.runtime.lock() = Some(MessageBridgeRuntime { task });\n        Ok(())\n    }\n\n    pub(super) async fn handle_session_update(&self, server_api: Arc<ServerApi>) -> Result<()> {\n        if !self.state_dir.exists() {\n            return Ok(());\n        }\n        let hydrator = self.hydrator(server_api);\n        let _guard = self.state_lock.lock().await;\n        acknowledge_parent_bridge_hook_output(&hydrator, &self.state_dir).await?;\n        prepare_parent_bridge_hook_output(\n            &hydrator,\n            &self.state_dir,\n            parent_bridge_max_context_chars(),\n        )\n        .await\n    }","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/driver/harness/claude_code/parent_bridge.rs#L179-L215","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry starting the agent session once — if the drop was a startup race, a fresh session starts the bridge cleanly.","Check logs for why the AgentDriver was dropped (session crash, harness error) and fix that root cause first.","If it recurs, report a lifecycle race between bridge start and driver teardown with the surrounding logs."],"exampleFix":"// before\nstart_result.await?; // aborts session setup on transient spawn drop\n\n// after (one retry on dropped-driver)\nif start_result.await.is_err() {\n    log::warn!(\"bridge start raced driver teardown; retrying\");\n    // re-invoke the bridge start once before surfacing an error\n}","handlingStrategy":"try-catch","validationCode":"if foreground.is_dropped() {\n    anyhow::bail!(\"agent driver gone; restart the session instead of starting the bridge\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(err) = bridge.start(server_api).await {\n    if err.to_string().contains(\"Agent driver dropped while starting Claude message bridge\") {\n        // session lifecycle race: recreate the session rather than retrying the bridge on a dead driver\n    } else { return Err(err); }\n}","preventionTips":["Start the message bridge as part of session creation, before any teardown path can run.","Avoid concurrent start/stop of the same session's bridge.","Watch for driver-drop errors as a symptom of an earlier session crash — fix that root cause first."],"tags":["lifecycle","claude-code","message-bridge","race-condition","rust"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}