Skip to content

"com.sun.jdi.InvalidStackFrameException occurred while retrieving value." when breaking on an exception #1955

Open

Description

Description

When debugging an Exception in a test, if I go to a different Java file and back, I am no longer able to check variables' content.

Versions

OS : Windows 11 25H2
Visual Studio Code : 1.145.2
Java (used to launch the test) : 25
Test Runner for Java extension : 0.47.0
Debugger for Java extension : 0.60.0

To reproduce

  1. Have a test that throws an Exception
  2. Activate Breakpoint on Caught Exceptions
  3. Debug the test
  4. When the debugger pauses on the exception, either hover on a variable, or have a watched expression. You should see that it works fine.
  5. Open another Java file
  6. Go back to the breakpoint.

Actual outcome

On hover, the variable now displays "com.sun.jdi.InvalidStackFrameException occurred while retrieving value." If the watched expression is refreshed, it will show the same.

Expected outcome

It should show the variable content, just like it did in step 4.

Activity

  1. issuelens commented on Nov 10, 2026

    @issuelens

    Thanks for the clear reproduction. This looks like a test-debugging bug in the variable-evaluation path rather than test execution: the test extension launches a java debug session, while hover/watch values are resolved by the Java debugger.

    A closely related older debugger report, vscode-java-debug#767, has the same exception-breakpoint/variable failure and traced it to an invalid cached stack frame after the target thread resumed. Your editor-navigation trigger is different, so there is not enough evidence to mark this as a duplicate; it may be a regression or another route to stale frame state.

    As a temporary workaround, stepping once or resuming to a fresh breakpoint may establish a new valid frame. To narrow this down, could you attach the Java language server and Debugger for Java logs covering steps 4–6, and confirm whether the same sequence fails when debugging a regular Java application rather than a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions