microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
40 stars 17 forks source link

`KeyError: 'params'` error when re-running pytest test #338

Open DetachHead opened 1 month ago

DetachHead commented 1 month ago

this started happening as of the latest vscode update (1.89.0)

to reproduce:

  1. put a breakpoint in a pytest test image
  2. right click the run button and click "Debug test"
  3. when it pauses on the breakpoint, click the restart button image
  4. check the debug console
    Traceback (most recent call last):
      File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main
        return _run_code(code, main_globals, None,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in _run_code
        exec(code, run_globals)
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
        cli.main()
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
        run()
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
        runpy.run_path(target, run_name="__main__")
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
        return _run_module_code(code, init_globals, run_name,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
        _run_code(code, mod_globals, init_globals,
      File "c:\Users\user\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
        exec(code, run_globals)
      File "c:\Users\user\.vscode\extensions\ms-python.python-2024.6.0\python_files\vscode_pytest\run_pytest_script.py", line 62, in <module>
        test_ids_from_buffer = raw_json["params"]
                               ~~~~~~~~^^^^^^^^^^
    KeyError: 'params'
brenoimatos commented 1 month ago

Same thing happening here.

alfonzso commented 1 month ago

Workaround (till not fixed): install/downgrade ms-python.python == 2024.4.1 version.

golgor commented 1 month ago

Also started experiencing this. Thanks for the workaround @alfonzso!

iiwolf commented 1 month ago

This was driving me nuts and I couldn't find a thread on it! Can confirm that downgrading works

eleanorjboyd commented 4 weeks ago

Hello! We are aware of this issue and actively working to get a fix- apologies for the delay this ended up being a more complex fix than anticipated. Thanks