Vscode: Save Failed - A system error occurred (UNKNOWN: unknown error, ftruncate)

Created on 27 Sep 2018  路  15Comments  路  Source: microsoft/vscode

Issue Type: Bug

After editing XML files and try to save with Ctrl + S i get the following error and the file isn't saved:
Failed to save 'xxxxxxxxxxx.xml': A system error occurred (UNKNOWN: unknown error, ftruncate)

I've only seen this issue with XML files and only occasionally. I have tried disabling all extensions but the issue persists.

Other editors are able to access and save the file.

VS Code version: Code 1.27.2 (f46c4c469d6e6d8c46f268d1553c5dc4b475840f, 2018-09-12T16:17:45.060Z)
OS version: Windows_NT x64 10.0.17134


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 x 4008)|
|GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled|
|Memory (System)|31.89GB (16.96GB free)|
|Process Argv|C:\Users\Tom Seagrave\AppData\Local\Programs\Microsoft VS Code\Code.exe D:\Projects\Application\base\iAssort - ConfigurationMenu.xml|
|Screen Reader|no|
|VM|0%|

Extensions (11)

Extension|Author (truncated)|Version
---|---|---
vscode-eslint|dba|1.6.0
xml|Dot|2.3.2
auto-close-tag|for|0.5.6
mssql|ms-|1.4.0
csharp|ms-|1.16.1
sublime-keybindings|ms-|4.0.0
java|red|0.31.0
vscode-java-debug|vsc|0.13.0
vscode-java-pack|vsc|0.3.0
vscode-java-test|vsc|0.9.0
vscode-maven|vsc|0.11.0


bug verified

Most helpful comment

I had the same issue but noticed it was occurring when I had "git diff" opened. I was able to save when I did exit from git diff command

All 15 comments

@feynman11 is that a file on a network drive maybe?

@bpasero no it was a local file. Is there anyway to get more info from the error? All I can see is the error message shown in the bug report.

@feynman11 can you install node.js from here, then:

  • create a XML file on that drive so that you can write to it and remember the path
  • open a terminal
  • run node
  • type fs.writeFileSync(<pathToFile>, "Hello World")

Does that work without error?

@bpasero I have been unable to replicate the issue today, I will try those steps if I get the issue again.

Ok please do.

I'm facing this issue every save attempt with 1.27.x, no issues whatsoever with 1.26.1, same files, same extensions, even with all extensions disabled. I can't install full Node.js on my machine right now, is there another way I can help you find this issue? If the answer is no, I will be able to install Node.js in a couple of days and will run the fs.writeFileSync command then.

Edit: this is what I get on Output Log (Windows)
[renderer1] [error] doSave(2) - exit - resulted in a save error: Error: UNKNOWN: unknown error, ftruncate {"$mid":1,"fsPath":"k:\\php\\lib1.php","external":"file:///k%3A/php/lib1.php","path":"/k:/php/lib1.php","scheme":"file"}

@feynman11 did it work before, in 1.26. e.g.?

@glha thanks for the report, there was a change in 1.27 that might have an impact (https://github.com/Microsoft/vscode/issues/6363).

@bpasero I've only ever seen it in version 1.27.2

I pushed a fix to fallback to the previous save code when fs.truncate fails. I am still not fully understanding what our truncation could fail while saving with node.js works otherwise (because they will truncate as well).

@feynman11 @glha can you maybe try to see if the issue is fixed for you with this build that includes the fix: Download

@bpasero I am not able to replicate the issue on that build. But I'm no longer facing this issue on the latest stable build either.

Ok thanks.

@bpasero I'm not able to replicate the issue on that build either (1.29.0-exploration).

I had the same issue but noticed it was occurring when I had "git diff" opened. I was able to save when I did exit from git diff command

I constantly have this error for every file on a network location since 1.28.2.

I can confirm, the bug is no longer present in the linked version 1.29 from above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omidgolparvar picture omidgolparvar  路  3Comments

chrisdias picture chrisdias  路  3Comments

trstringer picture trstringer  路  3Comments

v-pavanp picture v-pavanp  路  3Comments

borekb picture borekb  路  3Comments