vscode-sftp
vscode-sftp copied to clipboard
error 'no such file' during upload on save
I have an error during the upload when saving file this is the log on view->option->sftp could you help me ? thanks in advance
[04-26 14:48:02] [error] Error: No such file
at SFTPStream._transform (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:412:27)
at SFTPStream.Transform._read (internal/streams/transform.js:205:10)
at SFTPStream._read (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:183:15)
at SFTPStream.Transform._write (internal/streams/transform.js:193:12)
at writeOrBuffer (internal/streams/writable.js:358:12)
at SFTPStream.Writable.write (internal/streams/writable.js:303:10)
at Channel.ondata (internal/streams/readable.js:719:22)
at Channel.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Channel.Readable.push (internal/streams/readable.js:223:10)
at SSH2Stream.
I am getting the same issue. I've used this extension for over a year and it only stopped over the weekend. Worked perfectly on Friday, 4/23/2021, but failed first thing this morning. Possibly a VSCode update? I'm using Insiders Edition and haven't tried the regular edition. @davidesnc , are you on Insiders or regular edition of VSCode?
+1 on insiders. Does seem like it does upload, so it's just a false positive.
Not a false positive. I agree that some of the times it still writes the files but not others. If you Sync Local -> Remote on a directory for instance some files get wiped out on the remote or end up blank or cut short. My entire build fails after a Sync because of missing file contents on the remote.
I am getting the same issue. I've used this extension for over a year and it only stopped over the weekend. Worked perfectly on Friday, 4/23/2021, but failed first thing this morning. Possibly a VSCode update? I'm using Insiders Edition and haven't tried the regular edition. @davidesnc , are you on Insiders or regular edition of VSCode?
I'm using insider version too. I agree that probably was an update of vscode to create the issue. I'm searching for an alternative, may be do you have some suggestions ?
I opened a bug report on VS Code but there have been a few hundred commits since last Friday. I wasn't able to find anything specific that is an obvious reason for this. I'm going to try installing the non Insiders edition to see if it still works and to check which Nodejs version is being used. The errors are in calls to stream which is internal to Nodejs. Otherwise, I might need to switch to using the Microsoft "Remote - SSH" extension which I didn't want to do since my remote doesn't use git.
As expected, VS Code, non Insiders, works fine. It is also on Node 12.18.3 where Insiders is on 14.16.0. I'm not sure when Insiders updated but it might be a Node issue.
@mbinette thanks for your investigation job.
Hi. Just confirming that I get the same issue on Insiders. Didn't try normal edition.
a stupid workaround, but it works for me. ~/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js row 412 and follow.... /* //davidescnc var err = new Error(msg || STATUS_CODE_STR[code] || 'Unknown status'); err.code = code; err.lang = lang; cb(err); */ //davidesnc cb();
Just another "me too", but to add that switching to "FTP" protocol instead of "SFTP" still works (but very slow for some reason). Not ideal, but helped in a pinch.
a stupid workaround, but it works for me. ~/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js row 412 and follow.... /* //davidescnc var err = new Error(msg || STATUS_CODE_STR[code] || 'Unknown status'); err.code = code; err.lang = lang; cb(err); */ //davidesnc cb();
Cleaner approach to this would actually be to edit the line n°386 this from
if (code === false)
return;
to this
if (code === false || code === STATUS_CODE.NO_SUCH_FILE)
return;
This way, you don't lose other error warnings, just the "no such file" one. Still, quite bad to have to resort to this kind of workaround...
Same issue here. Just got updated today normal edition 1.56.0. So I guess they didn't fix the bug in the insider version and now the normal edition has the same problem. Regardless of the error, the files are still synced.
Cleaner approach to this would actually be to edit the line n°386 this from
if (code === false) return;to this
if (code === false || code === STATUS_CODE.NO_SUCH_FILE) return;This way, you don't lose other error warnings, just the "no such file" one. Still, quite bad to have to resort to this kind of workaround...
This did not work for me. It stuck reporting it was uploading.
I did just implement @davidesnc hack. That works fine on the surface.
Hello, please overlook my fault if you find because this is the first time to post comment here github.
I was getting same issue with probability normal edition v1.12.9. So, I added a patch code to c:\Users<username>.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js line: 388 like below reference to workarounds which are introduced by davidesnc and Webbeh above.
if (code === STATUS_CODE.OK) {
to this
if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
And, restart VSCode.
It seems working well for the present.
code === STATUS_CODE.NO_SUCH_FILE
Thanks! Hoping the vscode could officially fix this any time soon
another workaround is to downgrade to 1.55 https://code.visualstudio.com/updates/v1_55
Another "me too". also getting this on normal version 1.56.0. however, the upload function does seem to be uploading correctly despite the "no such file" error toast
Hello, please overlook my fault if you find because this is the first time to post comment here github.
I was getting same issue with probability normal edition v1.12.9. So, I added a patch code to c:\Users
.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js line: 388 like below reference to workarounds which are introduced by davidesnc and Webbeh above.
if (code === STATUS_CODE.OK) {to thisif (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {And, restart VSCode.
It seems working well for the present.
It's almost work perfectly, but doesn't work when you sync from local -> remote
well, i downgrade vscode to 1.55 and reinstall this ext fix this problem
I'm also getting this error. I've noticed that it will successfully transfer some files and others will be transferred with zero bytes (resulting in an error). I've rolled back to 1.55 and turned off auto updates for now. Fingers crossed it gets resolved soon.
This did not work for me. It stuck reporting it was uploading.
Oops, just saw that myself, it stuck reporting the upload of the first file you uploaded in that session.
Do it in line 388 instead :
if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {
instead of
if (code === STATUS_CODE.OK)
Of course, revert line 386 back.
Result :

It's almost work perfectly, but doesn't work when you sync from local -> remote
You may have another issue. Try using the fix in my previous message. If it still doesn't work, use https://github.com/liximomo/vscode-sftp/issues/915#issuecomment-828452687
Sure update Issued this bug. I reinstalled version 1.55.2, and sftp extensions works well again.
It's almost work perfectly, but doesn't work when you sync from local -> remote
You may have another issue. Try using the fix in my previous message. If it still doesn't work, use #915 (comment)
Actually, I've already done everything. It's fine when it's come to save file by file. But, when you trying to perform local sync to remote, it become infinite loading... or maybe it just me
The final solution I do, is downgrade to 55
It's almost work perfectly, but doesn't work when you sync from local -> remote
Since upload local -> remote also still works, you can apply this patch to avoid seeing the error.
In file ...\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.js
change line 416
cb(err);
to
cb();
That way you can still upload files, dont have to downgrade, and just dont see the annoying error.
It's almost work perfectly, but doesn't work when you sync from local -> remote
Since upload local -> remote also still works, you can apply this patch to avoid seeing the error. In file
...\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\sftp.jschange line 416cb(err);to
cb();That way you can still upload files, dont have to downgrade, and just dont see the annoying error.
This does the same as my solution, except it discards all errors.
@Webbeh I see that this discards all errrors, but your fix didnt solve the erorr on upload local -> remote for me. The error vscode throws me is 'Handle is invalid'. The error code is 4, corresponding to FAILURE.
I reverted my previous patch on line 416, and made line 388:
if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE || code === STATUS_CODE.FAILURE) {
However, this indeed still discards a lot of errors
Do it in line 388 instead :
if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) {instead ofif (code === STATUS_CODE.OK)
That didnt work for me, local -> remote still not uploading and getting popup error.
But this did!
Another "same here", updated to latest VS Code and suddenly had this issue. Been using it for a couple years now.