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

“Unable to write program user data” when invoking VS Code as git editor #68744

Closed
outoftime opened this issue Feb 14, 2019 · 24 comments
Closed
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@outoftime
Copy link

  • VSCode Version: 1.31.0
  • OS Version: Ubuntu 18.04.1 LTS

Steps to Reproduce:

  1. Enter a git-tracked directory
  2. Run GIT_EDITOR='code --wait' git commit --allow-empty
  3. Observe an error dialog appears:

Unable to write program user data.

Please make sure the directory /home/mat/.config/Code is writeable

Just to make sure, I did recursively make that directory world-writable, but it didn’t help.

I tried it with today’s code-insiders build and the issue persists.

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot added the git GIT issues label Feb 14, 2019
@joaomoreno
Copy link
Member

What happens when you run code?

@joaomoreno joaomoreno added info-needed Issue requires more information from poster and removed git GIT issues labels Feb 18, 2019
@outoftime
Copy link
Author

@joaomoreno it opens VS Code as expected.

@sq787
Copy link

sq787 commented Feb 18, 2019

I use CentOS 7. get an error just by running code.
After a recent update VSCode have this issue.

@joaomoreno
Copy link
Member

@outoftime How about code --wait?

@outoftime
Copy link
Author

@joaomoreno invoking code --wait from the terminal opens VS Code as expected

@joaomoreno
Copy link
Member

Can you show me a screenshot of that error dialog?

@youssefhabri
Copy link

I'm getting the same error:
screenshot from 2019-02-20 15-07-27

@outoftime
Copy link
Author

Update: I no longer have this problem on VS Code 1.31.1:

$ code --version
1.31.1
1b8e8302e405050205e69b59abb3559592bb9e60
x64

I am encountering a different bug, which is that the commit editor always opens in a new window, even when the commit is initiated from the integrated terminal, and even when --reuse-window is supplied as an option. I will open a separate issue for that.

@weichea
Copy link

weichea commented Feb 22, 2019

i got the same error as well.. on version 1.31.1.

@Technical27
Copy link

Technical27 commented Feb 27, 2019

if I run code it pops up the same message, but a manual open works. can confirm on the latest version. also code --wait pops up the same message too.

@joaomoreno
Copy link
Member

@bpasero Have you seen this?

@bpasero
Copy link
Member

bpasero commented Feb 27, 2019

This dialog is from us when we get an error of type EACCESS or EPERM on startup:

https://github.com/Microsoft/vscode/blob/ce073b0076ac2f69faf2c609af72f9b81506c791/src/vs/code/electron-main/main.ts#L215L222

@joaomoreno
Copy link
Member

@weichea @Technical27 Can you check permissions on that folder?

@outoftime
Copy link
Author

@joaomoreno I did note in the original bug report that I had tried recursively making the folder world-writable and it did not help.

@Technical27
Copy link

Technical27 commented Feb 28, 2019

Now code and code --wait works fine now after closing my terminal after using
chmod -R +rw ~/.config/Code
This will give everything in the folder write and read permissions
EDIT: I know this won't help OP but I am leaving it here to help anyone else

@lsl
Copy link

lsl commented Mar 5, 2019

@bpasero The error message has a bug, the path its referring to is just the config setting not the one path generating the error, any path could be causing it.

This means people in this thread could be having a number of different issues.

My issue is potentially just a dupe of #3884 but I'm not sure.

I disable write access to my home dir specifically because of things like this so seeing this error and suspecting home dir access was probably the issue, I enabled writes and once again could start code without the error. Only now with a ~/.vscode-oss/extensions path being created.

Deleting the .vscode-oss directory and adding this env var lets me start code without the error and without the needless home dir pollution.

export VSCODE_EXTENSIONS="${XDG_DATA_HOME:-~/.local/share}/code-oss/extensions"

@bpasero
Copy link
Member

bpasero commented Mar 5, 2019

@lsl good catch. I pushed a change so that the error dialog talks about both the user data path as well as the extensions path. Both need to be writable for VSCode to startup properly.

bpasero added a commit that referenced this issue Mar 5, 2019
@kadoradob
Copy link

I'm getting the same error:
i have the same problem.
how did you solve it ? thanks

@AHermann94
Copy link

AHermann94 commented Mar 14, 2019

@lsl unfortunatelly, I do not understand your solution. Could you please explain it to me?
where exatly did you add the env var? where is this document at all?
I have Ubuntu 18.04.
To be honest, I can't even find the files from vscode, except for the one file named "code" in usr/bin/.
Could you please help me out?

Kind regards,
An Ubuntu noob.

@AHermann94
Copy link

Never mind. Solved the problem by deinstalling and manually deleting the directories home/.vscode and home/.config/Code. Then installing it again by downloading the .deb file from the official site and installing it using the command sudo install ./code_1.32.2-1552488294_amd64.deb

@SciaticNerd
Copy link

SOLVED by deleting the Code directory from /home/MyUserDirectory/.config and then re-starting VScode from the menu.

To be clear:
$ code

::Pop up with Unable to write program user data::

$ cd /home/YourUserDirectory/.config
$ sudo rm -rf Code
[enter your password as needed]
$
[no news is good news...so you should only get a prompt back - meaning, the directory and all its contents got deleted]
$ code
[or launch from the menu]
took an extra moment... and then VSCode came right up!

Before this I had tried installing with Anaconda-Navigator, which is where the 'cannot write' error started... uninstalled... re-installed Anaconda.. no improvement. Then manually uninstalled and re-installed. Still no help... Searched on the error message and found this article... scrolled all the way down... only to find @AHermann94 explaining that manually deleting the folders after uninstalling worked... so I thought I would see what would happen if I just deleted the offending folder... And it WORKED! I figured the program might re-create the folder if it couldn't find it... looks like it did.

Happy coding!

@AHermann94
Copy link

Curious. I also first installed it with anaconda (after installing anaconda, it asks you if you want to also install vscode). So probably an error in the way anaconda installs it.

@lsl
Copy link

lsl commented Mar 19, 2019

@AHermann94 the error is caused by corrupted permissions/ownership in your config/data files.

You can either fix the permission/ownership issues or just delete everything and start fresh.

Check ownership / permissions: ls -al ~/.code ~/.vscode* ~/.config/Code*

Delete all config / extensions and start over:

rm -r ~/.code
rm -r ~/.vscode*
rm -r ~/.config/Code*

.code and .config/Code* are equivalent, .vscode is where extensions live. One or more of these may not exist, ignore the not found / no match errors. Use sudo if something can't be deleted.

For windows users you probably need to see #3884 for the APPDATA dirs.

@github-bogolub
Copy link

I had this message pop up on my openSUSE Leap 15.0 installation until I granted group/world write permission to the /run/user directory so that VS Code could write "*.sock" files there.

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests