Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using "SFDX: Launch Apex Replay Debugger With Current File" often throws error "Apex language server could not provide information about valid breakpoints" #5717

Open
PieterJacob opened this issue Aug 8, 2024 · 27 comments

Comments

@PieterJacob
Copy link

PieterJacob commented Aug 8, 2024

Summary

When trying to debug a .log file using the replay debugger, after right clicking on the .log file and choosing "SFDX: Launch Apex Replay Debugger With Current File", often an error is thrown: "Apex language server could not provide information about valid breakpoints". This happens to multiple developers in our team.

This issue is something that has already occurred for many months

Steps to Reproduce:

It is difficult to reproduce since it is unclear what causes this issue. But by describing the possible work around, it might clarify more what can cause this issue and how to fix it properly.

  1. Open a random debug file (.log) that was generated for the current project.
  2. Right click on the debug file and choose: "SFDX: Launch Apex Replay Debugger With Current File".
  3. After a certain loading time the error: '"Apex language server could not provide information about valid breakpoints" occurs and makes it impossible to debug. Reloading VS Code does not help.

Workaround

  1. After experiencing the error, for the current project, navigate to the folder that holds the apex.db file. In my case the location of this folder is at: .sfdx\tools\250\apex.db.

My assumption is that deleting the apex.db file and starting the replay debugger again creates a new apex.db file that is correctly in sync with the project, what might also explain the underlying issue, i.d. that the apex.db after a while gets out of sync...

Expected Result

There should occur no error and the Replace Debugger should start without any errors.

Actual Result

After right clicking on the .log file and choosing "SFDX: Launch APex Replay Debugger With Current File" an error occurs: "Apex language server could not provide information about valid breakpoints".

Additional Information

Below screen shows how to activate the Replay Debugger
image
Followed by error:
image
The workaround is to delete the apex.db file:
image

Salesforce Extension Version in VS Code:
v61.7
Salesforce CLI Version:
@salesforce/cli/2.51.6 win32-x64 node-v20.15.0

OS and Version:
Name: Windows 11
Edition: Windows 11 Enterprise
Version: 23H2

VS Code Version:
1.92.0

@svc-idee-bot
Copy link
Collaborator

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

Copy link

git2gus bot commented Aug 9, 2024

This issue has been linked to a new work item: W-16457498

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob, Thank you for filing this issue, and sorry for the inconvenience. Yes, this is a bug, and it's also a known issue. We have received it twice in the past, and as you stated as a workaround, both times the Apex Replay Debugger started working again after deleting the apex.db file. I filed a bug in my team's backlog.

In the meantime, can we get some info from you to help us reproduce it on our end? We would like the following info:

  1. org id of your org
  2. org shape (how many Apex classes, Apex test classes, custom objects, size of each Apex class/test class)
  3. How long is a typical Apex Replay Debugger session before you see that error and have to delete the apex.db? Is this value consistent across the developers on your team?

@PieterJacob
Copy link
Author

PieterJacob commented Aug 11, 2024

Hi @daphne-sfdc,
Thank you so much for taking your time and responding to this issue.
See below for my input regarding your questions.

1. Org Id of your org
This issue seems org unrelated. Like mentioned, this issue occurs for everyone in our team and for each newly created scratchOrg.

2. Org shape (how many Apex classes, Apex test classes, custom objects, size of each Apex class/test class)
We have around 2500+ classes in our code base, 400 of these calsses are test classes. We have around 250 custom objects (including custom metadata types and custom settings).

3. How long is a typical Apex Replay Debugger session before you see that error and have to delete the apex.db? Is this value consistent across the developers on your team?
Also this seems unrelated. It seems to happen for every .log file. The last example I could find was a debug file of around 2mb where the issue occurred.

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob, Thank you for providing the above details. I tried creating a project with 2400 Apex classes and 400 Apex test classes, but I was unable to reproduce your issue by running Apex Replay Debugger on that project. Our next step would be to ask you to share a zip file of your project and the credentials of your scratch org with us, but for security reasons, we don't work with credentials via unsecured channels like Github issues or email.

Can you file an official Salesforce support ticket and route that ticket to us, the IDE Experience Team? We'll continue working with you on this issue via the Investigation. Thank you.

@diyer
Copy link
Collaborator

diyer commented Aug 19, 2024

Hi @PieterJacob, are you still seeing this issue?

@PieterJacob
Copy link
Author

PieterJacob commented Aug 20, 2024

Hi @daphne-sfdc and @diyer,

Sorry for my late response. The issue still occurs and I think that I now have a better understanding when the issues occurs.
I noticed that when working on the same branch and scratchorg, and once I had removed the apex.db file the issues were resolved and I could create numerous new debug files and debug without the error occurring.

But... once I created a new branch and scratchorg and loaded my first debug file the error appeared again straight away. My colleagues also confirmed this. Important to add is that the the branch switch potentially causes a source code difference, since new classes and objects were added in the previous branch.

So it seems that the error is likely to show when you switch to a new branch and scratchorg - and possibly new objects such as classes and SObjects had been added in the previous branch - and start a new debug session.
Hope this new insight helps to solve the issue.

Peter,

@daphne-sfdc
Copy link
Contributor

Hello @PieterJacob,

I tried creating a new branch and new scratch org, then running Apex Replay Debugger on a file only present in that branch and scratch org. I then switched to a branch and scratch org without the file that I ran the ARD on, and used the log generated from the first run to run ARD on the second branch and scratch org. Despite the file not being present, I was still not seeing the error that you're getting.

In this week's release v61.10.0, our team added additional telemetry to Apex Replay Debugger to aid in diagnosing issues such as yours. Can you please update your Salesforce Extensions for VSCode to the latest version and rerun the Apex Replay Debugger to get the error? And also, can we get your machine ID so that we can use it to find your info in our telemetry? (Please email the machine ID to us at [email protected] instead of posting it in a public Github issue.)

@diyer
Copy link
Collaborator

diyer commented Aug 27, 2024

@PieterJacob we will need your help in providing details that @daphne-sfdc requested above.

@mnunezdm
Copy link

Hello!

I'm also experiencing this issue, in my case, I have the sensation that is related to rapid changes in apex classes, for example changing branches that have a lot of changes between them

In our case we have a lot of classes, more than 7K

How do you get the machine id?

@PieterJacob
Copy link
Author

@daphne-sfdc,
Thanks for your answer. I will update my cli and provide the information as soon as I receive the same error again, I will ask my colleagues as well.

Now do I get my machine Id?

@peternhale
Copy link
Contributor

@PieterJacob I recommend using the Salesforce CLI Id. The same value is sent in telemetry and it is easy to discover.

run sf telemetry and the output will look like this

sf telemetry
Telemetry is enabled.
Telemetry tmp directory is .......
Telemetry cache directory is ........

Salesforce CLI ID is 7e...................................b1.

capture the hexadecimal string value for Salesforce CLI ID and email it to the address noted earlier.

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob and @mnunezdm,

What is your current value in the Salesforcedx-vscode-apex › Java: Memory setting? (If it's a blank value, the default is 512MB.)

If you have a blank value or lower, can you try increasing your memory allocation for the Apex Language Server to 1024 and see if that resolves the issue?

@PieterJacob
Copy link
Author

@daphne-sfdc,

Thanks for the tip. The value was blank and I changed it to 1024. I'll make sure to test this in the upcoming week and keep you posted about my experiences regarding debugging.

@PieterJacob
Copy link
Author

@daphne-sfdc,

I updated the value of Salesforcedx-vscode-apex › Java: Memory to 1024, but unfortunately, as soon as I created a new branch and scratch org, bam! I received the error again.

It really seems that when you switch from one branch to the other and the new branch contains a reasonable amount of object differences, that it is more likely to have to error to occur.

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob, Sorry to hear that the workaround didn't work.

We're currently tracing back the error message in our codebase. To help us identify the correct path, can you please provide your Salesforce CLI ID by running sf telemetry in your Terminal as @peternhale suggested in his earlier message? Please email it to us at [email protected].

@PieterJacob
Copy link
Author

@daphne-sfdc,

Thanks a lot. I have just send [email protected] an email with my Salesforce CLI Id.
Hope this helps, thanks.

Peter,

@daphne-sfdc
Copy link
Contributor

@PieterJacob We found this old issue where the error that you're getting is caused by the presence of both a static and non-static variable of the same name in the same scope. Using the code in the image below (image taken from the thread of that old issue), I was able to reproduce the issue when running Apex Replay Debugger from the anonymous Apex file.
image

Can you please verify that you don't have both a static and non-static variable of the same name in your code?

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob,

Another question: In a previous message I saw you wrote "The last example I could find was a debug file of around 2mb where the issue occurred."

From that statement, I was wondering: What is the size of the Apex classes that you are running the Apex Replay Debugger on? I'd like to get an approximate idea of the number of lines of code that you have in your Apex classes.

@daphne-sfdc
Copy link
Contributor

@PieterJacob Two more things:

  1. Can you please update your extensions and CLI to the latest version if you haven't done so already?
  2. We want to ensure you have telemetry enabled in the following 3 places:
    a. Set Telemetry: Telemetry Level in VSCode settings to all.
    b. Check the box for Salesforcedx-vscode-core > Telemetry: Enabled.
    c. Type sf telemetry in your Terminal and make sure you see the "Telemetry is enabled" message.

@PieterJacob
Copy link
Author

PieterJacob commented Sep 6, 2024

@daphne-sfdc,
I highly doubt we have classes in our system that both have a static and instance specific variable that share the same name, I would have expected that the compiler would scream at you in this instance. Besides, I don't know a way to check this other than looking over all classes individually.

Regarding our class sizes. We try to keep classes small and concise. I would say by average classes have no more than 1000 lines, with an average of 200 lines.

Ill make sure to update my CLI version. Thanks.

@daphne-sfdc
Copy link
Contributor

Hi @PieterJacob,
One more request: Please do the following steps:

  1. Go to the Output Tab with Apex Language Server for the dropdown.
  2. Clear the Output Tab.
  3. Launch the Apex Replay Debugger to get the "Apex language server could not provide information about valid breakpoints" error again.
  4. Close the error popup.
  5. Go back to the Output Tab with Apex Language Server for the dropdown.
  6. Send us the stack trace from the Output tab.

Here's a short video of how to do the above instructions:

Screen.Recording.2024-09-06.at.3.45.01.PM.mov

Copy link

This issue has not received a response in 3 days. It will auto-close in 2 days unless a response is posted.

@github-actions github-actions bot added the stale label Sep 10, 2024
@diyer
Copy link
Collaborator

diyer commented Sep 10, 2024

@PieterJacob Thank you for your patience but we need one last thing from your end to try. Can you please refer to Daphne's comment above and share the contents of your output tab?

@github-actions github-actions bot removed the stale label Sep 11, 2024
Copy link

This issue has not received a response in 3 days. It will auto-close in 2 days unless a response is posted.

@github-actions github-actions bot added the stale label Sep 15, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2024
@mnunezdm
Copy link

mnunezdm commented Sep 26, 2024

Hi!

I was having the error earlier this day

I sent requested info to [email protected]

@diyer @daphne-sfdc

@eburtness
Copy link

Hi @daphne-sfdc — I'm seeing this error and deleting apex.db and then reloading VS Code seems to work around it. I sent a stack trace and CLI ID to [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants