VS Code not launching after incorrect command execution on Ubuntu 22.04

I’m experiencing an issue with Visual Studio Code on my Ubuntu 22.04 system. I accidentally executed an incorrect command in the terminal, and since then, VS Code hasn’t been working properly. Here are the details:

I intended to open a folder in VS Code using code . , but I mistakenly typed code ,

This command seems to have caused issues, and now VS Code fails to launch.
When I try to run VS Code, I get various error messages in the terminal. Here are some of the notable logs:

MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory
failed to load driver: iris
MESA-LOADER: failed to open kms_swrast: /usr/lib/dri/kms_swrast_dri.so: cannot open shared object file: No such file or directory
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory
failed to load swrast driver

Additionally, I see numerous warnings and errors related to extensions and GPU processes crashing.

I removed the potential problematic file (rm ,).
I tried reinstalling VS Code using Snap but still face the same issues:
Cleared VS Code cache and settings:
Despite these efforts, the problem persists. Has anyone encountered a similar issue or can guide how to resolve this?

Asked By: Somar kn

||

I faced this issue today on my Ubuntu 24.04 and thought it might be a bug. After several restarts and updates, I realized it was bugging in the Snap Store version. So I downloaded the .deb package from their Official Downloads. Then I used apt to install the package.

sudo apt install ./code_1.90.0-1717531825_amd64.deb

Now my Visual Studio Code is working fine with all my previous data on the latest version.

If you want to use the previous Snap version instead of .deb package, you can use this command:

$ sudo snap revert code
Answered By: Ajay

I had the same issue today. I was able to revert to a previous version of the snap and it started normally.

$ snap list code --all 
Name  Version   Rev  Tracking       Publisher  Notes
code  dc96b837  159  latest/stable  vscode✓    
disabled,classic
code  89de5a8d  160  latest/stable  vscode✓    classic

So I reverted to the most recent version.

$ sudo snap revert --revision=159 code

or simply

$ sudo snap revert code

I don’t want to use the .deb version so this is an alternative for those who wish to stay on snap.

Answered By: user1804875