{"record":{"id":"91756b65fa3701a9","repo":"helix-editor/helix","slug":"failed-to-set-breakpoints","errorCode":null,"errorMessage":"Failed to set breakpoints: {}","messagePattern":"Failed to set breakpoints: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"helix-view/src/handlers/dap.rs","lineNumber":140,"sourceCode":"        })\n        .collect::<Vec<_>>();\n\n    let request = debugger.set_breakpoints(path, source_breakpoints);\n    match block_on(request) {\n        Ok(Some(dap_breakpoints)) => {\n            for (breakpoint, dap_breakpoint) in breakpoints.iter_mut().zip(dap_breakpoints) {\n                breakpoint.id = dap_breakpoint.id;\n                breakpoint.verified = dap_breakpoint.verified;\n                breakpoint.message = dap_breakpoint.message;\n                // TODO: handle breakpoint.message\n                // TODO: verify source matches\n                breakpoint.line = dap_breakpoint.line.unwrap_or(0).saturating_sub(1); // convert to 0-indexing\n                                                                                      // TODO: no unwrap\n                breakpoint.column = dap_breakpoint.column;\n                // TODO: verify end_linef/col instruction reference, offset\n            }\n        }\n        Err(e) => anyhow::bail!(\"Failed to set breakpoints: {}\", e),\n        _ => {}\n    };\n    Ok(())\n}\n\nimpl Editor {\n    pub async fn handle_debugger_message(\n        &mut self,\n        id: DebugAdapterId,\n        payload: helix_dap::Payload,\n    ) -> bool {\n        use helix_dap::{events, Event};\n\n        match payload {\n            Payload::Event(event) => {\n                let event = match Event::parse(&event.event, event.body) {\n                    Ok(event) => event,\n                    Err(dap::Error::Unhandled) => {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/helix-editor/helix/blob/079a789e8cb08ead67f19e1971a1b7438b37354b/helix-view/src/handlers/dap.rs#L122-L158","documentation":"In the DAP handler, after a debug session is asked to set breakpoints via helix-dap, an Err(e) result (an ErrorResponse from the adapter) is bailed out as \"Failed to set breakpoints: {e}\". The Ok branches copy adapter-verified line/id/message back into the local breakpoints; the error means the adapter itself rejected or failed the setBreakpoints request.","triggerScenarios":"Setting a breakpoint while the debug session has terminated or is not initialized yet; the file not being recognized as source by the adapter (path mismatch, non-mapped/script files without sourcemap); adapter-specific limits such as breakpoints on invalid lines or unsupported conditions.","commonSituations":"Pressing the breakpoint toggle before the debugger finishes launching; debugging generated/renamed files whose paths differ from what the adapter loaded; adapters with partial breakpoint support (logpoints, conditions); adapter process crashed mid-session.","solutions":["Confirm the debug session is still alive (:debugger / DAP log) and the adapter finished initializing before setting breakpoints.","Open :log-open and check the DAP trace for the adapter's own error detail (path mismatch, unsupported request, line invalid).","Verify the breakpoint is in a file the debugged program actually maps to source; for script/guest languages ensure path translation is configured in the DAP config.","If the adapter rejects conditional/log breakpoints, set an unconditional one to isolate the cause."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if !editor.debugger_is_running(adapter_id) {\n    return Err(anyhow!(\"no active debug session; start the debugger before setting breakpoints\"));\n}","typeGuard":null,"tryCatchPattern":"if let Err(err) = set_breakpoints_result {\n    if err.to_string().contains(\"Failed to set breakpoints\") {\n        // adapter-level rejection: keep local breakpoint but mark unverified, log DAP detail\n        breakpoint.verified = false;\n        log::warn!(\"adapter rejected breakpoint: {err}\");\n    } else {\n        return Err(err);\n    }\n}","preventionTips":["Only set breakpoints after the DAP initialized event.","Keep the DAP log open (:log-open) while debugging breakpoint failures.","Verify the file's path matches the program's source roots; configure path mapping for containers/remote."],"tags":["dap","debugging","breakpoints","helix","rust"],"backgroundTag":null,"analyzedSha":"079a789e8cb08ead67f19e1971a1b7438b37354b","analyzedAt":"2026-08-16T09:09:59.668Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}