{"record":{"id":"938c78d05f73f320","repo":"zed-industries/zed","slug":"request-failed","errorCode":null,"errorMessage":"Request failed: {}","messagePattern":"Request failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dap/src/client.rs","lineNumber":152,"sourceCode":"            sequence_id\n        );\n        log::debug!(\"  response: {response:?}\");\n\n        match response.success {\n            true => {\n                if let Some(json) = response.body {\n                    Ok(serde_json::from_value(json)?)\n                // Note: dap types configure themselves to return `None` when an empty object is received,\n                // which then fails here...\n                } else if let Ok(result) =\n                    serde_json::from_value(serde_json::Value::Object(Default::default()))\n                {\n                    Ok(result)\n                } else {\n                    Ok(serde_json::from_value(Default::default())?)\n                }\n            }\n            false => anyhow::bail!(\"Request failed: {}\", response.message.unwrap_or_default()),\n        }\n    }\n\n    pub async fn send_message(&self, message: Message) -> Result<()> {\n        self.transport_delegate.send_message(message).await\n    }\n\n    pub fn id(&self) -> SessionId {\n        self.id\n    }\n\n    pub fn binary(&self) -> &DebugAdapterBinary {\n        &self.binary\n    }\n\n    /// Get the next sequence id to be used in a request\n    pub fn next_sequence_id(&self) -> u64 {\n        self.sequence_count.fetch_add(1, Ordering::Relaxed)","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/dap/src/client.rs#L134-L170","documentation":"From Client::request<R> in the DAP client: the adapter answered a request with a Response whose success flag is false, and the bail interpolates response.message (empty string when the adapter omits it, due to unwrap_or_default). Per the Debug Adapter Protocol, this is the adapter's structured way to reject a request - launch/attach failures, invalid arguments, unsupported commands.","triggerScenarios":"Any client.request::<R>(args) call where the adapter replies success=false: LaunchRequest with a nonexistent program path, AttachRequest with a bad PID/port, SetBreakpointsRequest with unresolvable locations, EvaluateRequest after the debuggee terminated, or any request the adapter does not support. Adapters that set success=false without a message yield the bare 'Request failed: ' string.","commonSituations":"Wrong 'program' path in launch.json/debug config; adapters whose working directory differs so relative paths fail; requests issued after the session ended; adapter-specific argument schema mismatches after an adapter upgrade.","solutions":["Check the request that preceded it in Zed's DAP log (request/response pairs are debug-logged) and fix its arguments","Verify program/paths are absolute or resolvable from the adapter's cwd","Confirm the debuggee is still running before issuing evaluate/variables requests","For an empty message, enable adapter logging to see the response body - the adapter omitted the message field"],"exampleFix":"// before\nlet caps = client.request::<InitializeRequest>(args).await?;\n\n// after: surface the adapter's message instead of an opaque error\nlet caps = match client.request::<InitializeRequest>(args).await {\n    Ok(caps) => caps,\n    Err(err) => {\n        log::warn!(\"initialize rejected by adapter: {err:#}\");\n        return Err(err.context(\"adapter rejected initialize; check adapter path and arguments\"));\n    }\n};","handlingStrategy":"try-catch","validationCode":"// Validate the program path before launching through the adapter\nif let Some(program) = &launch_args.program {\n    anyhow::ensure!(program.exists(), \"program path does not exist: {program:?}\");\n}","typeGuard":null,"tryCatchPattern":"match client.request::<LaunchRequest>(args).await {\n    Ok(_) => { /* proceed to configurationDone */ }\n    Err(err) => {\n        // err message is the adapter's own reason, or empty when omitted\n        return Err(err.context(\"launch rejected by adapter; verify program/args/cwd\"));\n    }\n}","preventionTips":["Pre-validate launch config (program exists, cwd exists, port reachable) before sending DAP requests","Treat every DAP request as fallible; never assume success=false implies transport death","Enable DAP debug logs to pair the failed request with the adapter's response"],"tags":["dap","debug-adapter","protocol","launch","rust"],"backgroundTag":"debug-adapter-request-failed","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}