Skip to content

Ruby rdbg: the attach configuration of the template has no localfs and no port, so breakpoints aren't hit and attaching fails #2293

Done

Description

@muescha

Problem 1: breakpoints are not hit

With the attach configuration of the ruby-rdbg template, a breakpoint in hello.rb is never hit:

  • attach.json has only type, name and request.
  • rdbg answers the setBreakpoints request with verified: false and the message /path/to/hello.rb could not be located; specify source location in launch.json with "localfsMap" or "localfs".
  • The program then runs to its end without stopping.

The Ruby page shows the same JSON, so following it leads to the same result.

Cause

rdbg maps local paths only when localfs or localfsMap is set, and it sets this default only for launch, not for attach (server_dap.rb of debug 1.11.1):

  • L314, launch: UI_DAP.local_fs_map_set req.dig('arguments', 'localfs') || req.dig('arguments', 'localfsMap') || true
  • L321, attach: the same call without || true, so the map stays nil.
  • L361: with no map, every breakpoint gets the message above.
  • The attach configuration that rdbg itself writes for VS Code sets localfs: true (L33-L38).

Problem 2: attaching fails without a port

The template sets the Port field to $port, but attach.json has no port. The Ruby page says to add "port": 12345 by hand. If that step is missed, the run configuration starts anyway and fails only when it connects. The Debug console shows:

Attaching 'Ruby Debug' at :-1
java.lang.IllegalArgumentException: port out of range:-1
Disconnected successfully from the debug server.
  • The message shows neither which field is wrong nor how to fix it.
  • The settings editor already knows it: next to the Port field it shows ? instead of a port.

Cause

No check for a missing port

This part is not specific to Ruby: any DAP run configuration in Attach mode whose port can't be resolved starts and fails the same way.

Proposal

  1. Add "localfs": true to attach.json, and show it in the JSON of the Ruby page:

    {
      "type": "rdbg",
      "name": "Attach with rdbg",
      "request": "attach",
      "localfs": true
    }

    localfs: true assumes that rdbg runs on the same file system as the IDE. That is the case for the rdbg --open --port 12345 hello.rb setup that the page describes. A remote setup would need localfsMap instead.

  2. For the port, one of:

    • add "port": 12345 to attach.json, matching the command on the Ruby page, or
    • keep it out of the template, but let checkConfiguration report an attach port that can't be resolved, for example Attach port is missing: add "port" to the DAP parameters or enter a port. IntelliJ then shows the error in the run configuration dialog and before the start, instead of the exception.

The check in checkConfiguration would help every template, the default port only Ruby.

How this was checked

  • Ruby 4.0.9 (installed with mise), debug 1.11.1, LSP4IJ 0.30.2-SNAPSHOT.
  • IntelliJ IDEA 2026.3.1 Preview, and IntelliJ IDEA 2024.2 started with ./gradlew runIde, on macOS.
  • rdbg --open --port 12345 hello.rb, breakpoint on puts user.
  • Without localfs: the breakpoint is reported as not located and the program runs through.
  • With "localfs": true: the session stops on puts user.
  • Without port in the DAP parameters: the console shows port out of range:-1, as above.

Pair-programmed with ❤️ by @muescha and ⚙️ by 🤖 Claude Code

Activity

  1. added this to the 0.30.3 milestone on Nov 26, 2026
  2. lagergren commented on Nov 26, 2026

    @lagergren
    Collaborator

    Problem 1 is fixed by #2294: the template's attach.json sets "localfs": true, and the Ruby page shows and explains it. Problem 2, a clear error for a missing attach port in DAPRunConfiguration.checkConfiguration that would help every template, stays open here for 0.30.3.

  3. modified the milestones: 0.30.3, 0.30.2 on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions