Skip to content

"List index error out of range" when debugger breaks on uncaught exception #1745

@kunom

Description

@kunom

Environment data

  • debugpy version: 1.8.7
  • OS and version: Windows 11
  • Python version (& distribution if applicable, e.g. Anaconda): 3.13.0, downloaded from python.org
  • Using VS Code or Visual Studio: VS Code

Actual behavior

When the debugger breaks on an exception, the following output appears in the terminal:

2.79s - Error on build_exception_info_response.
Traceback (most recent call last):
  File "c:\Users\mek\.vscode\extensions\ms-python.debugpy-2024.12.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_comm.py", line 1533, in build_exception_info_response 
    stack_str = "".join(stack_summary.format())
                        ~~~~~~~~~~~~~~~~~~~~^^
  File "c:\Program Files\Python313\Lib\traceback.py", line 749, in format
    formatted_frame = self.format_frame_summary(frame_summary, colorize=colorize)
  File "c:\Program Files\Python313\Lib\traceback.py", line 553, in format_frame_summary
    last_line = all_lines_original[frame_summary.end_lineno - frame_summary.lineno]
                ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

Expected behavior

The output distracts. Also, there might be functional degradation.

Steps to reproduce:

In Visual Studio Code, enable "halt on exception", F5-debug a file that throws an exception

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions