VSCode shows an error when a subprocess in a program under debug exits very fast and the subProcess: true is defined in launch.json.

The problem disappears when subProcess: false is set.
Reproduced on two different machines (W11+WSL)
When running the debugger via Powershell on Windows the problem is not reproducible. Only W11+WSL.
Environment data
- debugpy version: v2025.8.0
- OS and version: Windows 11 + Debian GNU/Linux 12 (bookworm) (WSL2) [Remote host]
- Python version: 3.11.2
- Using VS Code: 1.101.0
Actual behavior
When debugging a python program that spawns a subprocess that exits too quickly this error is shown:

It happens randomly and is possibly related to the subprocess exiting while the debugger is being attached.
Expected behavior
Error does not pop up and the debugger handles such case gracefully.
Steps to reproduce:
- Run code that spawns another python subprocess - for example with a module that doesn't exist
import subprocess
def main():
cmd = "python3 -m idontexist"
for i in range(0, 20):
process = subprocess.Popen(cmd.split())
process.wait()
if __name__ == "__main__":
main()
VSCode shows an error when a subprocess in a program under debug exits very fast and the
subProcess: trueis defined in launch.json.The problem disappears when
subProcess: falseis set.Reproduced on two different machines (W11+WSL)
When running the debugger via Powershell on Windows the problem is not reproducible. Only W11+WSL.
Environment data
Actual behavior
When debugging a python program that spawns a subprocess that exits too quickly this error is shown:
It happens randomly and is possibly related to the subprocess exiting while the debugger is being attached.
Expected behavior
Error does not pop up and the debugger handles such case gracefully.
Steps to reproduce: