vscode: Can't Save File
Issue Type: Bug
Open a file (in my case the hosts file in Windows) Press Ctrl. + S or go to File > Save
Expected Result: File saved successfully. (Or at least an error asking to retry as administrator, since it’s a system file) Actual Result:

VS Code version: Code - Insiders 1.66.0-insider (e80a0ca648fe9bef07070e4f7fb04e67f2243252, 2022-03-07T05:16:48.804Z) OS version: Windows_NT x64 10.0.19044 Restricted Mode: No
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx (8 x 2296) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 21.94GB (4.47GB free) |
| Process Argv | –crash-reporter-id 1e3fa7b6-bc32-40ff-8f5b-cc46fa4e5dfc |
| Screen Reader | no |
| VM | 0% |
Extensions (28)
| Extension | Author (truncated) | Version |
|---|---|---|
| vuerd-vscode | din | 0.9.15 |
| gitlens | eam | 12.0.1 |
| gitkraken-authentication | git | 1.0.3 |
| terraform | has | 2.20.0 |
| rest-client | hum | 0.24.6 |
| l13-diff | L13 | 1.0.3 |
| vscode-docker | ms- | 1.20.0 |
| csharp | ms- | 1.24.1 |
| vscode-kubernetes-tools | ms- | 1.3.6 |
| vscode-postgresql | ms- | 0.3.0 |
| remote-containers | ms- | 0.225.0 |
| remote-ssh | ms- | 0.77.2022030315 |
| remote-ssh-edit | ms- | 0.77.2022030315 |
| powershell-preview | ms- | 2022.2.2 |
| vsliveshare | ms- | 1.0.5418 |
| vscode-sanddance | msr | 3.3.0 |
| fabric8-analytics | red | 0.3.5 |
| java | red | 1.4.0 |
| vscode-commons | red | 0.0.6 |
| vscode-yaml | red | 1.5.0 |
| scala | sca | 0.5.5 |
| sonarlint-vscode | Son | 3.3.3 |
| vscodeintellicode | Vis | 1.2.17 |
| vscode-java-debug | vsc | 0.38.0 |
| vscode-java-dependency | vsc | 0.19.0 |
| vscode-java-pack | vsc | 0.22.0 |
| vscode-java-test | vsc | 0.34.1 |
| vscode-maven | vsc | 0.35.1 |
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30422396
pythontb:30258533
pythonvspyt551cf:30291413
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805cf:30301675
pythonvspyt200:30323110
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
wslgetstarted:30421357
vsclayoutctrt:30405800
dsvsc009:30440021
pythonvspyt640:30438691
vsbas813:30436447
vscscmwlcmc:30428972
azactmsal:30432848
vscgsvid2:30433758
dockersurvey3:30438168
pynewfile477:30443519
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 15 (4 by maintainers)
Commits related to this issue
- Can't Save File (fix #144614) — committed to microsoft/vscode by bpasero 2 years ago
Pushed a fix for https://github.com/microsoft/vscode/issues/147929 which was actually a real bug in the code that handles errors on save, however you would still see a save failure I suppose, so I suggest that people report back on Monday with insiders what happens.
This happens to me multiple times a day. While I haven’t been able to pinpoint the origin of this behavior, I believe it might be related to certain git actions – branch switching and pulling. Sadly the only way to solve the problem is to discard changes.