salesforcedx-vscode: Cannot read properties of null (reading 'capabilities')

Type: Bug

This error ocurrs when the vsCode starts

Extension version: 59.5.1 VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs 11th Gen Intel® Core™ i7-1185G7 @ 3.00GHz (8 x 1805)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 15.73GB (1.64GB free)
Process Argv –crash-reporter-id 4f197115-1501-46a7-8fd3-5e8f9c3fa569
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30880072
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
282f8724:30602487
89544117:30613380
2i9eh265:30646982
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30887144
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30871694
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
accentitlementst:30887150
dsvsc016cf:30886111
dsvsc017:30886112
dsvsc018cf:30886115
aa_t_chat:30882232

About this issue

  • Original URL
  • State: closed
  • Created 7 months ago
  • Comments: 30 (11 by maintainers)

Most upvoted comments

Hi @JohannyRA - I had the same issue as you. I’m using a mac, so I don’t believe this is OS specific.

The problem is that the Apex Language Server is failing to start. In my case (and I suspect yours too), it was because my apex.db had become corrupted somehow.

On hunting around through the code, I found this article which suggested deleting the local (project level) apex database.

Reset Apex Indexing To clear the Apex Language Server’s indexing, delete the PROJECT_DIR/.sfdx/tools/<Salesforce Release> directory and restart VS Code.

This worked for me. My extensions are now working correctly and I can navigate around Apex classes again which is a relief.

How to fix it

So in practical terms, here’s what I recommend trying:

1. Close VSCode

I actually also completely uninstalled the extensions and reinstalled them at the end of these steps, but I don’t think that was strictly necessary.

2. Find and kill any orphaned apex language server processes.

Windows

On windows… There is some advice above. I would have to do a bit more reading to give you a definitive answer.

However, there is a class in this repo that does this… so maybe you could find your answer there too. See a combination of:

Or just follow this article on How to Kill a Process in Windows

Mac

On a Mac, this can be achieved with 2 commands.

To see any running apex language processes, execute:

pgrep -fl apex

To kill the processes, execute:

pkill -f apex

(There are many ways to achieve this, this is just the simplest way I found… Make sure you understand what the flags mean etc.)

3. Delete the PROJECT_DIR/.sfdx/tools/<Salesforce Release> directory

On Mac, run the following command (where PROJECT_DIR is your sfdx project directory and SF_RELEASE is the numbered release folder)

rm -rf PROJECT_DIR/.sfdx/tools/SF_RELEASE

for me, this folder was: my_sfdx_repo/.sfdx/tools/246

4. Restart VSCode

At this point, the apex language service should rebuild your apex.db database file and any other files it needs and start the apex language server.

Now you should be good to go 😃 😃

Hope that helps!!

Duncan

@dunks184 It works well now.