Skip to content

DAP session disconnects when setBreakpoints references a virtual file from a previous session #1455

Closed

Description

@ericbodden

Description

This is in relation to my use of lsp4j as described in issue #1447

When a DAP run configuration has a file name pattern mapping (e.g., *.fair) and a breakpoint was set in a sourceReference-backed virtual file during a previous debug session, restarting the debug session causes lsp4ij to send setBreakpoints for that stale breakpoint during configuration. This triggers a Failed to map LightVirtualFile error and lsp4ij immediately sends disconnect — without ever sending configurationDone — aborting the session before the debugger can start.

Reproduction

  1. Configure a DAP run configuration with a virtually mapped file (.fair in my case) and *.fair file name pattern in the Mappings tab
  2. Start a debug session — the DAP server serves .fair sources via sourceReference (virtual, read-only files)
  3. Set a breakpoint in a .fair file shown in the editor
  4. Stop the debug session
  5. Start the debug session again

Expected behavior

The session should start normally. Stale breakpoints for virtual files that no longer exist should either be silently discarded or sent as verified:
false without aborting the session. configurationDone should always be sent.

Actual behavior

In my case, lsp4ij sends setBreakpoints with:
{
"source": {
"name": "main.fair",
"path": "82a9b8c8/DAP Constant Propagation/main.fair"
},
"breakpoints": [{"line": 7}]
}

Note: no sourceReference field — the source is identified only by an internal path from the previous session.

The DAP server responds with verified: false. Then lsp4ij logs:

Failed to map LightVirtualFile: 82a9b8c8/DAP Constant Propagation/main.fair
(filesystem com.redhat.devtools.lsp4ij.dap.client.files.DAPFileSystem@59e3b538) into nio Path

And immediately sends disconnect — configurationDone is never sent.

Full DAP trace

[Trace] Sending request 'initialize - (1)'
[Trace] Received notification 'initialized'
[Trace] Received response 'initialize - (1)' in 172ms
[Trace] Sending request 'setBreakpoints - (2)' ← stale breakpoint
[Trace] Sending request 'launch - (3)'
[Trace] Received response 'setBreakpoints - (2)' in 5ms (verified: false)
[Trace] Received response 'launch - (3)' in 7ms
Failed to map LightVirtualFile: 82a9b8c8/DAP Constant Propagation/main.fair ...
[Trace] Sending request 'disconnect - (4)' ← no configurationDone!

Environment

  • IntelliJ IDEA 2025.3.3
  • lsp4ij (latest)
  • Custom DAP server using sourceReference-backed virtual files (no real files on disk)

Activity

  1. ericbodden commented on Apr 7, 2026

    @ericbodden
    ContributorAuthor

    As a side effect, this pull request here seems to cause this problem to be now also handled gracefully: #1457

  2. angelozerr commented on Apr 7, 2026

    @angelozerr
    Contributor

    You mean #1457 fix also your #1455 issue?

  3. angelozerr commented on Apr 8, 2026

    @angelozerr
    Contributor

    Fixed with #1457

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions