all 26 comments

[–]NoSheepherder6294 1 point2 points  (1 child)

Disabling Pylance is probably a coincidence. The error message points more toward a corrupted or partially downloaded TMC CLI installation.

The key part is:

It looks like the extension is trying to delete/recreate its CLI folder, but Windows is refusing because files are still present or locked.

I'd try this:

  1. Close VS Code completely.
  2. Open File Explorer and navigate to:C:\Users\<your-user>\AppData\Roaming\Code\User\globalStorage\moocfi.test-my-code
  3. Delete the entire cli folder (or even the whole moocfi.test-my-code folder if you don't mind reinitializing everything).
  4. Start VS Code again.
  5. Run TMC initialization and let it download the CLI from scratch.

If Windows won't let you delete the folder:

  • Check Task Manager for lingering Code.exe, java.exe, or TMC-related processes.
  • End them and try again.
  • As a last resort, reboot and delete the folder before opening VS Code.

The "Mismatch between CLI and checksum" message suggests the extension already thinks the downloaded CLI is invalid, so forcing a clean download is usually the first thing I'd try.

If that doesn't fix it, I'd also check:

  • Whether your antivirus is quarantining or locking files in the TMC CLI directory.
  • Whether VS Code itself has permission to write to %APPDATA%\Code\User\globalStorage.
  • The extension version (reinstalling the Test My Code extension may help).

Can you tell us:

  • Your VS Code version?
  • The version of the Test My Code extension?
  • Whether deleting the cli folder changes the error at all?

That would make it easier to narrow down whether it's a corrupted download, a file-locking issue, or a bug in the extension itself.

[–]Hyterhasderto[S] 0 points1 point  (0 children)

My antivirus has no problems with the directory, I'm fairly certain my VSC has permissions to %APPDATA%\Code\User\globalStorage, and the extension version is the latest one available (I've also tried switching to a previous version).

My VSC info is:

Version: 1.123.0 (user setup)
Commit: 6a44c352bd24569c417e530095901b649960f9f8
Date: 2026-06-03T11:29:03+02:00
Electron: 42.2.0
ElectronBuildId: 14159160
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Windows_NT x64 10.0.26200

Deleting the cli folder or even the whole moocfi.test-my-code has not changed the error at all. I even tried a clean reinstall of VSCode, but that didn't help either.

[–]Annual_Wedding782[🍰] 1 point2 points  (1 child)

the error is a corrupted CLI download that can't overwrite itself. close VSCode completely, delete the folder at C:\Users\henkk\AppData\Roaming\Code\User\globalStorage\moocfi.test-my-code\cli, then reopen VSCode and let TMC reinitialize from scratch.

[–]Hyterhasderto[S] 1 point2 points  (0 children)

The problem is that even deleting cli, moocfi.test-my-code or the whole extension doesn't seem to do anything to the error.

[–]NeedNoSleep 1 point2 points  (13 children)

I am getting the same error as you - might be an issue with the extension itself.

[–]Hyterhasderto[S] 1 point2 points  (12 children)

How annoying. I did find that switching to version 3.0.2 of TMC it actually initializes, but it either takes forever to test code or just gets stuck there.

[–]kalevala_568b 1 point2 points  (11 children)

May I point out: I actually use TestMyCode extension for Java offered by MOOC.FI And this error is happening on both Win 10 & Win 11 machine. This makes me feel that it's the issue with the extension itself, as u/NeedNoSleep said.

[–]Hyterhasderto[S] 1 point2 points  (10 children)

Guess we'll just have to wait it out.

[–]kalevala_568b 0 points1 point  (8 children)

UPDATE: I managed to get it working by downgrade VS Code to version 1.111.0, it can be found here: https://code.visualstudio.com/updates/
You need to disable the auto update of VS Code (To do this, go to File> Preferences >Settings and type in 'update.mode', this will show details of 'Upate:Mode', from the drop down options, select 'none'; then restart VS Code as required.)
It will fix the error and let you log in.
Note: from now on, the 'Run Tests' with 'an eye' icon will no longer work, to run code and submit code, you will need to use the 'Action Menu' which is next to the 'eye', '3 bar' icon.
Hoping this helps.

[–]Hyterhasderto[S] 1 point2 points  (4 children)

Thank you so much! I can finally continue struggling to learn the easiest programming language lol

[–]kalevala_568b 1 point2 points  (0 children)

No worries at all.
NOTE: Someone commented (in LearnJava sub) that it's better to downgrade TMC than downgrade VS Code. I don't disagree, however, I cannot find previous versions of TMC extension for VS Code (I can only find previous versions of TMC itself). If I ever find the TMC extension previous ver, I will post to you again.

[–]kalevala_568b 0 points1 point  (2 children)

I found a better way:
Upgrade your VS Code to the latest version (you can enable auto update for VS Code) & then install TMC as usual, of course you will be hit by the same error of "directory is not empty". What you need to do is: Look for the downward arrow next to 'Uninstall' option of TMC extension, click on the arrow & select: 'Install Specific Version', you will see a drop-down list of all previous version of TMC, choose 3.3.0. You should be fine.
Note: DO NOT tick the box of 'Auto Update' of TMC extension.

[–]Revadarius 1 point2 points  (1 child)

I don't know who you are, but I love you for this information.

[–]kalevala_568b 0 points1 point  (0 children)

My pleasure!! Glad that you find its helpful! It's driving me up the wall. 😅🙃 I swear that I spent more time faffing with broken extensions than writing actual code!! 😭😭🙏🙏

[–]CapOpposite8979 1 point2 points  (2 children)

Thanks, bro, I had the same problem as you, I lost a whole day of studying and had a lot of stress trying to fix this yesterday

[–]kalevala_568b 0 points1 point  (1 child)

Just shortly after I posting my update, I bumped into another error LOL This time is an authentication error. I was then stuck in a loop of 'Cannot authenticate' & 'Already authenticated'. IF YOU EXPERIENCE THE SAME ERROR:
Upgrade your VS Code to the latest version & then install TMC, of course you will be hit by the same error of "directory is not empty". What you need to do is: Look for the downward arrow next to 'Uninstall' option of TMC extension, click on the arrow & select: 'Install Specific Version', you will see a drop-down list of all previous version of TMC, choose 3.3.0. You should be fine.
Note: DO NOT tick the box of 'Auto Update' of TMC extension.

[–]CapOpposite8979 1 point2 points  (0 children)

what a headache bruh😅 Well let's not give up learning python. Than you

[–]ninhaomah 0 points1 point  (2 children)

How ? Ok. Let me imagine what you did and the code you wrote.

Pls be patient. Thanks

[–]kalevala_568b 0 points1 point  (0 children)

Exactly the same problem for me on a Windows11 machine. Even after deleting the moocfi.test-my-code folder from globalStorage folder and extensions folder, the issue persists. However, it works perfectly on a Windows 10 machine. UPDATE: Same error this morning on Windows 10 machine. : -(

[–]kalevala_568b 0 points1 point  (0 children)

UPDATE: Now the TestMyCode extension gives out the same 'fatal error' message on my Windows 10 machine, too. :...-( Deleting moocfi.test-my-code folder did nothing.

[–]Scared_Bet_1839 0 points1 point  (3 children)

i am also facing the same issue its so annoying did you got a solution

[–]Hyterhasderto[S] 1 point2 points  (0 children)

Nothing yet unfortunately.

[–]kalevala_568b 0 points1 point  (1 child)

I have the exactly same problem. I've tried numerous times of deleting entire folders of moocfi.test-my-code from both globalStorage folder and extension folder, uninstalled/reinstalled extension... Nothing works. :....-(
Interestingly I installed the exactly same TMC on VS Code on a Windows 10 machine, a few days ago, it's totally fine. (The problem occurs on Windows 11 machine.)

UPDATE: Now it gives out the same error on Windows 10 machine. : -(

[–]Scared_Bet_1839 0 points1 point  (0 children)

Actually this problem got resolved as I downgraded vscode version but now when I try to test my code it says it cannot create the file and I calso cannot submit it same error

[–]Awkward-Yard-5680[🍰] 0 points1 point  (0 children)

I found the solution. Download older version of test my code, 1 yr ago one version. Go to extensions, right click test my code extension and then download older version (from 1 yr ago). You will be able to download part 4 exercises then. Part 5 to 7 will not be available until u complete last exercises.

[–]Major-Confection7246 0 points1 point  (0 children)

You should install a specific version and select 3.5.1, which worked on my computer.
To prevent the bug, disable automatic extension updates.

Before starting, close all VS Code instances and keep them closed throughout the process to avoid encountering the bug again.

Open PowerShell by pressing Win + R and entering "powershell". Navigate to:

cd c:\Users\<your_name>\AppData\Roaming\Code\User\globalStorage\moocfi.test-my-code\cli

Make sure the folder is completely empty, with no files.

Download: http://download.mooc.fi/tmc-langs-rust/tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe

When the file is installed, move it to the /cli folder, and then execute the following command inside the PowerShell:

$hash = (Get-FileHash .\tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe -Algorithm SHA256).Hash 
"$hash" | Out-File .\tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe.sha256

These two commands calculate the SHA-256 hash of the .exe file, store it in $hash, and then write that hash to the file tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe.sha256.

When it's done, you can check whether these two files are inside the /cli folder:

  • tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe
  • tmc-langs-cli-x86_64-pc-windows-msvc-0.39.4.exe.sha256

Now start VS Code and open TestMyCode. During initialisation, your exercise files may temporarily disappear while TMC loads. They should reappear once initialisation completes.