VS Code Debugger Not Working: How to Fix launch.json and Breakpoint Issues

Fix VS Code debugger when it fails to start, breakpoints are not hit, or launch.json has errors. Covers debugger extensions, configuration validation, source maps, and breakpoint troubleshooting.

7 min read

When the debugger does not start or skips breakpoints, first confirm the active debugger, then validate launch.json, and finally check whether the running code matches the source file. Stop when a breakpoint becomes solid red and execution pauses on it.

Check your debugger extension

VS Code includes a built-in JavaScript debugger for Node.js and browser code. Other languages and runtimes commonly get debugging support from extensions.

Open Run and Debug and use install additional debuggers if VS Code cannot offer a configuration for the current file. Before installing one, check its Marketplace publisher, supported runtime versions, permissions, pricing, privacy information, and remote-environment support. Follow that debugger's setup page because its launch.json properties are extension-specific.

Validate launch.json

When the debugger fails to start, the error is often in launch.json. See create and configure launch.json for more details. VS Code validates this file against the debugger's schema automatically. Open launch.json and look for red squiggly underlines; they mark invalid property names, wrong types, or missing required fields.

The official debug configuration reference confirms that every configuration needs type, request, and name. Other attributes vary by debugger. Check these issues in order:

  • "program" points to a file that does not exist: The path in the program field must match your project's entry file. Check that the path is relative to the workspace folder and the file exists.
  • Missing or unknown "type": The value must match an installed debugger. Use the suggestions offered in the file instead of copying a value from another language.
  • "request" is wrong: Use "launch" to start a new process and "attach" to connect to an already running process.
  • Wrong working directory: The "cwd" field defaults to the workspace root. If your program expects a different working directory, set it explicitly.

If the file is too damaged to repair confidently, rename .vscode/launch.json to .vscode/launch.json.backup. Then open Run and Debug and select create a launch.json file, or use Run > Add Configuration. VS Code detects available debug environments and creates or offers a starter configuration. Compare it with the backup before copying any project-specific values.

For the normal workflow, see the beginner's guide to Run and Debug.

Fix breakpoints that are not hit

A breakpoint that shows as a gray hollow circle instead of a solid red one means the debugger could not bind to that line. The code at that line is either not loaded by the debugger or does not match the source on disk.

Check source maps

If you are debugging transpiled code (TypeScript compiled to JavaScript, or bundled code from webpack), the running code is different from the source you see in the editor. Source maps tell the debugger how to map between them.

Confirm that your build actually emits source maps and that the debugger is launching the generated output from the current build. Do not copy an outFiles, program, or source-map setting from another toolchain; use the documentation for your compiler, bundler, and debugger together.

Check the program entry point

If your program uses a different entry point than what launch.json specifies, the debugger launches a different process than the one you are trying to debug. For Node.js, VS Code looks for a start script in package.json. Make sure it points to your actual entry file.

Verify the debugger is paused at the right place

Sometimes breakpoints are set correctly but the code path that contains them never executes. Add a simple breakpoint on the first line of your entry file. If even that is not hit, the program is not starting as expected. Check the Debug Console for any startup errors.

Check the Debug Console

The Debug Console at the bottom of the window shows output from your running program and any runtime errors. If your program crashes immediately, the error message and stack trace appear here. These errors are from your code, not from VS Code, and they often explain why the debugger stopped unexpectedly.

Also check the Problems panel for errors that prevent the program from building. Some debugger extensions provide a dedicated channel in View > Output; select it and follow its documentation if the launch error is not explained elsewhere.

Set a breakpoint with F9 on a line that runs immediately, start debugging with F5, and trigger that code path. Success means the breakpoint remains solid, execution pauses there, and the Variables section shows the current program state. Learn how to inspect runtime output in the Debug Console guide.

Rune AI

Rune AI

Key Insights

  • JavaScript debugging is built in; other runtimes can require a debugger extension.
  • launch.json attributes vary by debugger, so use its IntelliSense and documentation.
  • Back up a suspect launch.json before creating a clean configuration.
  • A gray hollow breakpoint means the debugger could not register it.
  • Check the error notification, Debug Console, and debugger-specific Output channel.
RunePowered by Rune AI

Frequently Asked Questions

Why do my breakpoints turn gray and hollow during debugging?

A gray hollow breakpoint means the active debugger could not register it. The file might not be loaded, the running output might not match the source, or source maps might not map that line. Hover over the breakpoint and inspect the debugger's message before changing configuration.

How do I know whether I need a debugger extension?

VS Code includes JavaScript debugging for Node.js and browser code. Other languages and runtimes normally receive debugging support from extensions. Use the install additional debuggers link in Run and Debug, then verify the extension's publisher and documentation before installing it.

Should I add trace to launch.json when debugging fails?

Only if the documentation for your active debugger supports that property. Launch attributes vary by debugger. Start with red launch.json diagnostics, the error notification, Debug Console, and the debugger-specific Output channel when one is provided.

Conclusion

Confirm the correct debugger is available, fix launch.json diagnostics with that debugger's schema, and test a breakpoint on code that definitely runs. A solid breakpoint that pauses execution and populates Variables confirms the debugger is attached to the intended program.