51

When debugging JavaScript code using Chrome Developer Tools the debugger pauses on code where breakpoints are not set. I don't have the Pause on exceptions feature enabled, and there definitely are not breakpoints set (see attached image).

I asked a similar question before which was helpful but didn't quite solve this issue (previously I had the Pause on exceptions enabled). In the example below I swapped out the minified version of kendo.all.min.js for the unminified version, which allows me to see where the script execution is being paused, but I don't know why it is being paused. This happens a lot with jquery.min.js too.

enter image description here

Community
  • 1
  • 1
Mark Erasmus
  • 2,305
  • 6
  • 25
  • 37
  • Have you tried `CTRL + F5` to refresh and clear the cache? – Tom May 08 '15 at 16:51
  • 2
    @Tom I pretty much exclusively use `CTRL + F5` when doing page refreshes. – Mark Erasmus May 08 '15 at 17:06
  • In Developer Tool under Sources, do you see any Breakpoints defined? – Jack May 08 '15 at 17:28
  • @JackPattishall Only the ones I have defined. – Mark Erasmus May 08 '15 at 17:50
  • 6
    I have had this so often; ghost breakpoints that break but don't show anywhere that I have delete and create profile in my mussle memory. Hope someday the Chrome team will fix this because it sure takes the fun out of using the deftools when it randomly stops at places you don't want it to and are unable to turn it off unless you turn off all breakpoints. – HMR Dec 02 '15 at 09:58

7 Answers7

58

I fixed my breakpoints problem by clicking the "Restore defaults and reload" button located in the “Settings” section. To find the button: In Developer Tools click the cogged wheel next to the top right three vertical dots. (Note: If using older versions of Google Chrome, click on the top right three vertical dots and then select “Settings F1”). The button “Restore defaults and reload” is at the bottom right.

Also note that it really restores defaults - you lose all previously saved breakpoints and any files you have open in Developer Tools will be closed.

I got this solution from: Chrome javascript debugger breakpoints don't do anything?

Crazy Cat
  • 1,332
  • 15
  • 19
  • 4
    This definitely works but it also will revert your console settings, like putting the console back in vertical orientation and any custom settings you forgot you put in there. I wish Chrome would step up their developer tools game. The debugger is a great tool but little ish like this is getting ann-oy-ing. – Dylan Pierce May 17 '17 at 14:36
  • 1
    2 years later this is still the only thing I've found that works so... don't hold your breath. – jcollum Jun 20 '19 at 16:25
  • 1
    a little over a year later, and this didn't work for me :( – Carlo Jul 30 '19 at 00:16
  • 1
    Tried this, but if I place a "debugger" statement, Chrome breaks on a line like 5 lines above my "debugger" and even within a "switch" statement that isn't even valid... WTF.. Edit: Tried in Firefox and that also breaks on the same incorrect line. Must be something within my Ionic/Angular project.. – ScottN Aug 21 '19 at 19:36
  • @ScottN hi, did you resolve I too have been putting up with this non-sense I am stuck on Ionic 3.x, let me know if you managed fixing these random popping breakpoints. – Meryan Jun 17 '20 at 19:10
  • @Meryan I actually kinda forgot about this issue. I haven't done a lot of Ionic development since I posted this comment, but I think I did upgrade the Ionic CLI to the latest and now I can't remember if that fixed it. Are you on the latest CLI or Ionic builder tools? – ScottN Jun 18 '20 at 20:04
  • I was suffering with this issue for weeks and this solution fixed it for me. – Michael Dec 01 '20 at 09:39
  • 2
    The "Restore defaults and reload" button seems to have moved. Don't klick the three dots but the cogged wheel next to the dots. There (after some scrolling) you will find the button. And yes... Breakpoints that are removed may still break code execution in 02-2021 – Bigman74066 Feb 06 '21 at 16:08
  • Here in 09-2021 and phantom breakpoints are still an issue... I found that I was able to close dev tools -> refresh page -> open dev tools -> refresh page and the phantom breakpoint seems to be gone now and I didn't have to revert all my settings. So maybe that will help someone else. – hurlbz Sep 01 '21 at 14:02
  • 2
    Here it is 2 years later after I wrote "2 years later" and the issue cropped up again and "Restore defaults and reload" fixed it again. – jcollum Mar 17 '22 at 20:15
  • The issue seems to have found its way into Edge as well since MS switched to Chromium based. Unbelievably annoying. – Brandon Jul 13 '22 at 03:58
  • 2
    2022 - still the only thing that helped. – tiriana Jul 18 '22 at 12:54
6

Accepted answer to Import/export Chrome devtools breakpoints & settings between computers reminded me to check "devtools-on-devtools" and in the DevTools' inner Application Local Storage remove the faulty element(s) of the JSON list value for key breakpoints to fix my same issue without resetting everything.


Later it happened again, so I wrote this console snippet:

((stores, matchKey, removeMatchingRegExp, dryRun)=>{for(let store of stores){
  let r = JSON.parse(localStorage[store]), l = r.length;
  r = r.filter(b=>!b[matchKey].match(removeMatchingRegExp));
  if(!dryRun) localStorage[store] = JSON.stringify(r);
  console.log(`${dryRun ? 'Would' : 'Did'} remove ${l - r.length} entries from ${store}:`, r)}; return 'OK'})
(['breakpoints', 'domBreakpoints'], 'url',
  new RegExp('^https?://example.com/script.js$'), true)

Note:

  • Provided without warranty: Use at own risk. Backup your data.
  • Edit it - at least the RegExp argument - to suite your needs.
  • The last-most boolean should be false to disable dryRun.
  • Outer DevTools must be reopened for effect.
vike
  • 339
  • 6
  • 10
1

I was able to resolve this by updating Chrome. I don't think the version matters, just the process of updating resets all of the breakpoints that have been stored in the cache.

Ralph David Abernathy
  • 5,230
  • 11
  • 51
  • 78
0

F8 has two functionalitys. 1. Skip ot next Breakpoint, 2.stop wherever the Browser is executing code. This works even if you have no breakpoint set. For example spamming F8 when you forgot to deactivate breakpoints might cause the browser to stop anywhere.

When you go to the debugger shortcuts you can see that F8 has the functionality to Pause / Continue. But it sadly seems like you can't split them on two different keybinds.

Since I know this feature I never ran into this "bug" anymore.

lehp
  • 1
0

I'm posting this answer in case it will help someone who, like me, missed an important clue as to the cause of the phantom breakpoint behavior. In my case, it was "user error" --mine. The root cause was a forgotten "debugger;" statement in a JavaScript file that was itself generated from TypeScript. I had removed the debugger; statement from TypeScript locally, run and tested without issue from localhost. But I had pushed the version with the statement to remote and it built and released to our dev site with the statement present. The dev site build excludes the TypeScript source files. When the debugger statement was hit, Chrome tried to load the .ts source and displayed "Could not load content..." I just assumed it was at a breakpoint (I'd set many during testing). And when I saw "No breakpoint" I assumed Chrome was experiencing the issue addressed in this thread. If I'd bothered to look in the Call Stack trace, I would have seen the source code line in the .ts file and pretty quickly figured it out. Here's a screenshot:

enter image description here

kenswdev
  • 189
  • 1
  • 2
  • 11
0

I'm getting the same problem, even with no apparent breakpoints set. The only thing that seems to stop it is to toggle the Deactivate breakpoints option (Ctrl + F8).

enter image description here

This prevents Chrome stopping at the phantom breakpoint and sometimes has caused it to appear (as disabled) against the source code, allowing it to be removed.

David G
  • 541
  • 4
  • 11
-1

just disable the cache and reload the page, the breakpoints will show up again

yasin
  • 270
  • 4
  • 6