helix-editor/helix · error · anyhow::Error

Failed to set breakpoints: {}

Error message

Failed to set breakpoints: {}

What it means

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.

Source

Thrown at helix-view/src/handlers/dap.rs:140

        })
        .collect::<Vec<_>>();

    let request = debugger.set_breakpoints(path, source_breakpoints);
    match block_on(request) {
        Ok(Some(dap_breakpoints)) => {
            for (breakpoint, dap_breakpoint) in breakpoints.iter_mut().zip(dap_breakpoints) {
                breakpoint.id = dap_breakpoint.id;
                breakpoint.verified = dap_breakpoint.verified;
                breakpoint.message = dap_breakpoint.message;
                // TODO: handle breakpoint.message
                // TODO: verify source matches
                breakpoint.line = dap_breakpoint.line.unwrap_or(0).saturating_sub(1); // convert to 0-indexing
                                                                                      // TODO: no unwrap
                breakpoint.column = dap_breakpoint.column;
                // TODO: verify end_linef/col instruction reference, offset
            }
        }
        Err(e) => anyhow::bail!("Failed to set breakpoints: {}", e),
        _ => {}
    };
    Ok(())
}

impl Editor {
    pub async fn handle_debugger_message(
        &mut self,
        id: DebugAdapterId,
        payload: helix_dap::Payload,
    ) -> bool {
        use helix_dap::{events, Event};

        match payload {
            Payload::Event(event) => {
                let event = match Event::parse(&event.event, event.body) {
                    Ok(event) => event,
                    Err(dap::Error::Unhandled) => {

View on GitHub (pinned to 079a789e8c)

Solutions

  1. Confirm the debug session is still alive (:debugger / DAP log) and the adapter finished initializing before setting breakpoints.
  2. Open :log-open and check the DAP trace for the adapter's own error detail (path mismatch, unsupported request, line invalid).
  3. 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.
  4. If the adapter rejects conditional/log breakpoints, set an unconditional one to isolate the cause.
Defensive patterns

Strategy: try-catch

Validate before calling

if !editor.debugger_is_running(adapter_id) {
    return Err(anyhow!("no active debug session; start the debugger before setting breakpoints"));
}

Try / catch

if let Err(err) = set_breakpoints_result {
    if err.to_string().contains("Failed to set breakpoints") {
        // adapter-level rejection: keep local breakpoint but mark unverified, log DAP detail
        breakpoint.verified = false;
        log::warn!("adapter rejected breakpoint: {err}");
    } else {
        return Err(err);
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of helix-editor/helix@079a789e8c (2026-08-16). Data as JSON: /api/errors/91756b65fa3701a9. Report an issue: GitHub.