I'm trying to get Apex debugging working in VS Code, following instructions here. When I launch the debugger I see a popup You exceeded your licensed number of debugging sessions. Please end other sessions or purchase more. even though I believe I have a license and there are no other debugging sessions.

The debug console shows:

Connected to Streaming API channel /systemTopic/ApexDebuggerSystemEvent.
Connected to Streaming API channel /systemTopic/ApexDebuggerEvent.
Disconnected from Streaming API channel /systemTopic/ApexDebuggerSystemEvent.
Disconnected from Streaming API channel /systemTopic/ApexDebuggerEvent.

My scratch org states Your org doesn't have any active Apex Debugger sessions and my DevHub is a production org and states Your child orgs aren't using any Apex Debugger licenses. You have 1 license available.

What am I missing? Is there anything I can do to debug this issue further?


You need to enable debugging in the scratch org by adding the "DebugApex" option to the "features" attribute of the scratch org definition file:

  "orgName": "Acme",
  "country": "US",
  "edition": "Enterprise",
  "description": "Scratch Org Name",
  "hasSampleData": "true",
  "features": ["DebugApex", "AuthorApex"],
  "orgPreferences": {
    "enabled": ["S1DesktopEnabled", "ChatterEnabled"],
    "disabled": []
  • Thanks for your response but I already had the DebugApex feature in my scratch org def. I actually didn't have AuthorApex but, having now added it, I'm still getting the license error when debugging. I also have the PermissionSet created as per the debugger setup instructions, and assigned to the default sysadmin user. Without the permission assignment I see a permission error whilst debugging so seems like it's getting that far at least. – Simon Watson Apr 13 '18 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.