wakatime / vscode-wakatime

Visual Studio Code plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vs-code
BSD 3-Clause "New" or "Revised" License
1.21k stars 134 forks source link

Unable to get api key: Error: spawn UNKNOWN #295

Open krishnans2006 opened 1 year ago

krishnans2006 commented 1 year ago

I installed the WakaTime VSCode extension, and entered my API Key. However, every few seconds, I am prompted to enter a new API key. On inspecting the developer console, I see the following from the WakaTime extension. Any ideas, or ways I can fix this?

image

alanhamlett commented 1 year ago

That error happens when vscode isn't able to read/write to your ~/.wakatime.cfg file. What OS are you using?

krishnans2006 commented 1 year ago

I'm on Windows - it is on somewhat of a restricted policy, so that may be the case (works fine on my other Linux PC). Although I don't see how it would be a problem to access a file in my home folder... (I'm assuming C:\Users\username\.wakatime.cfg).

I'll try to manually edit the file with my API key and see if that helps (in case it's only writes that don't work). Thanks for the help, I'll keep you posted!

alanhamlett commented 1 year ago

I'll try to manually edit the file with my API key and see if that helps

That should work. You still might get a warning on first startup when the plugin writes the ~/.wakatime-internal.cfg with it's last update check time but you can ignore that warning and the plugin will still work.

krishnans2006 commented 1 year ago

So the extension wrote the API key perfectly in ~/.wakatime.cfg.


[settings]
api_key = the_key

However, it can't read the API key it just wrote...

image

And my user definitely has read/write access to the file (I can open it up in Notepad and make changes as I please). Any ideas?

alanhamlett commented 1 year ago

The first two logs are normal, because at that time you hadn't entered your api key yet and the plugin was trying to read a file that didn't exist. Those two warnings are normal.

Then, after you entered your api key the third message (spawn UNKNOWN) occurred. That error sounds very similar to this previous issue. That issue was Windows Defender blocking the plugin.

It still seems like Windows isn't letting vscode read files in your user home folder. Can you open other files in your user home folder using vscode?