{"record":{"id":"d9e87de210530578","repo":"pola-rs/polars","slug":"cannot-locate-pid-definition-in-launch-json-for-rust-lldb","errorCode":null,"errorMessage":"Cannot locate pid definition in launch.json for Rust LLDB configuration. Please follow the instructions in the debugging section of the contributing guide (https://docs.pola.rs/development/contributing/ide/#debugging) for creating the launch configuration.","messagePattern":"Cannot locate pid definition in launch\\.json for Rust LLDB configuration\\. Please follow the instructions in the debugging section of the contributing guide \\(https://docs\\.pola\\.rs/development/contributing/ide/#debugging\\) for creating the launch configuration\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"py-polars/debug/launch.py","lineNumber":54,"sourceCode":"    launch_file = Path(__file__).parents[2] / \".vscode/launch.json\"\n    if not launch_file.exists():\n        msg = f\"Cannot locate {launch_file}\"\n        raise RuntimeError(msg)\n    with launch_file.open(\"r\") as f:\n        launch_info = f.read()\n\n    # Overwrite the pid found in launch.json with the pid for the current process.\n    # Match the initial \"Rust LLDB\" definition with the pid defined immediately after.\n    pattern = re.compile('(\"Rust LLDB\",\\\\s*\"pid\":\\\\s*\")\\\\d+(\")')\n    found = pattern.search(launch_info)\n    if not found:\n        msg = (\n            \"Cannot locate pid definition in launch.json for Rust LLDB configuration. \"\n            \"Please follow the instructions in the debugging section of the \"\n            \"contributing guide (https://docs.pola.rs/development/contributing/ide/#debugging) \"\n            \"for creating the launch configuration.\"\n        )\n        raise RuntimeError(msg)\n\n    launch_info_with_new_pid = pattern.sub(rf\"\\g<1>{pID}\\g<2>\", launch_info)\n    with launch_file.open(\"w\") as f:\n        f.write(launch_info_with_new_pid)\n\n    # Print pID to the debug console. This auto-triggers the Rust LLDB configurations.\n    print(f\"pID = {pID}\")\n\n    # Give the LLDB time to connect. Depending on how long it takes for your LLDB\n    # debugging session to initialize, you may have to adjust this setting.\n    time.sleep(LLDB_DEBUG_WAIT_TIME_SECONDS)\n\n    # Update sys.argv so that when exec() is called, the first argument is the script\n    # name itself, and the remaining are the input arguments.\n    sys.argv.pop(0)\n    with Path(sys.argv[0]).open() as fh:\n        script_contents = fh.read()\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/debug/launch.py#L36-L72","documentation":"launch_debugging applies a regex to launch.json to find the 'Rust LLDB' configuration's pid field and replaces it with the current process id. If the regex does not match, the launch.json exists but lacks the expected Rust LLDB pid definition, so it raises this RuntimeError with a pointer to the contributing guide.","triggerScenarios":"launch.json exists but has no 'Rust LLDB' entry with a \"pid\": <number> field, or its formatting differs from the expected pattern ('Rust LLDB', followed by \"pid\": digits).","commonSituations":"Hand-edited launch.json (renamed configuration, removed pid, changed formatting/order); older launch.json templates predating the pid-based flow.","solutions":["Follow the debugging setup at https://docs.pola.rs/development/contributing/ide/#debugging and recreate .vscode/launch.json exactly as documented","Ensure the configuration is named 'Rust LLDB' and contains a \"pid\": <integer> field immediately after the name","Restore the canonical launch.json from the contributing guide and re-run the 'Python: Debug Rust' configuration"],"exampleFix":"// before (.vscode/launch.json)\n{\"type\": \"lldb\", \"request\": \"attach\", \"name\": \"Rust debug\"}\n// after\n{\"type\": \"lldb\", \"request\": \"attach\", \"name\": \"Rust LLDB\", \"pid\": 0}","handlingStrategy":"validation","validationCode":"import re, pathlib\nlaunch_info = pathlib.Path('.vscode/launch.json').read_text()\nassert re.search(r'(\"Rust LLDB\",\\s*\"pid\":\\s*)\\d+(\")', launch_info), \"launch.json lacks the 'Rust LLDB' pid definition; see the contributing guide\"","typeGuard":null,"tryCatchPattern":"try:\n    run_debug_flow()\nexcept RuntimeError as e:\n    if 'Cannot locate pid definition' in str(e):\n        print('Recreate .vscode/launch.json per https://docs.pola.rs/development/contributing/ide/#debugging')","preventionTips":["Keep the 'Rust LLDB' configuration name and its \"pid\": <number> field exactly as documented","Avoid hand-edits that change the configuration name or move/remove the pid field","Refresh launch.json from the contributing guide after polars debug tooling updates"],"tags":["python","debugging","vscode","config","regex"],"backgroundTag":"missing-config-value","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}