vscode-sftp icon indicating copy to clipboard operation
vscode-sftp copied to clipboard

error 'no such file' during upload on save

Open davidesnc opened this issue 4 years ago • 64 comments
trafficstars

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. (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/Channel.js:167:15) at SSH2Stream.emit (events.js:315:20) at parsePacket (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3288:10) at SSH2Stream._transform (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13) at SSH2Stream.Transform._read (internal/streams/transform.js:205:10) at SSH2Stream._read (/Users/davide/.vscode-insiders/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15) at SSH2Stream.Transform._write (internal/streams/transform.js:193:12) at writeOrBuffer (internal/streams/writable.js:358:12) at SSH2Stream.Writable.write (internal/streams/writable.js:303:10) at Socket.ondata (internal/streams/readable.js:719:22) at Socket.emit (events.js:315:20) at addChunk (internal/streams/readable.js:309:12) at readableAddChunk (internal/streams/readable.js:284:9) at Socket.Readable.push (internal/streams/readable.js:223:10) at TCP.onStreamRead (internal/stream_base_commons.js:188:23) when local ➞ remote /opt/data/iseo/progetti/v364/server/uti/internal_obfuscate.php

davidesnc avatar Apr 26 '21 12:04 davidesnc

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?

mbinette avatar Apr 26 '21 18:04 mbinette

+1 on insiders. Does seem like it does upload, so it's just a false positive.

Darktex avatar Apr 26 '21 23:04 Darktex

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.

mbinette avatar Apr 26 '21 23:04 mbinette

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 ?

davidesnc avatar Apr 27 '21 06:04 davidesnc

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.

mbinette avatar Apr 27 '21 12:04 mbinette

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 avatar Apr 27 '21 12:04 mbinette

@mbinette thanks for your investigation job.

davidesnc avatar Apr 27 '21 12:04 davidesnc

Hi. Just confirming that I get the same issue on Insiders. Didn't try normal edition.

Webbeh avatar Apr 27 '21 13:04 Webbeh

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();

davidesnc avatar Apr 28 '21 13:04 davidesnc

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.

madwebskills avatar May 04 '21 06:05 madwebskills

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...

Webbeh avatar May 05 '21 06:05 Webbeh

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.

trivial-zero avatar May 05 '21 23:05 trivial-zero

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.

aesculus avatar May 06 '21 00:05 aesculus

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.

feijoa-pine avatar May 06 '21 00:05 feijoa-pine

code === STATUS_CODE.NO_SUCH_FILE

Thanks! Hoping the vscode could officially fix this any time soon

trivial-zero avatar May 06 '21 00:05 trivial-zero

another workaround is to downgrade to 1.55 https://code.visualstudio.com/updates/v1_55

Prodian0013 avatar May 06 '21 01:05 Prodian0013

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

joshuachough avatar May 06 '21 03:05 joshuachough

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 this if (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

rendiliaw avatar May 06 '21 04:05 rendiliaw

well, i downgrade vscode to 1.55 and reinstall this ext fix this problem

Gorvey avatar May 06 '21 05:05 Gorvey

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.

kineticvenergy avatar May 06 '21 06:05 kineticvenergy

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 : image

Webbeh avatar May 06 '21 06:05 Webbeh

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

Webbeh avatar May 06 '21 06:05 Webbeh

Sure update Issued this bug. I reinstalled version 1.55.2, and sftp extensions works well again.

Mickeywaugh avatar May 06 '21 07:05 Mickeywaugh

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

rendiliaw avatar May 06 '21 15:05 rendiliaw

The final solution I do, is downgrade to 55

rendiliaw avatar May 06 '21 15:05 rendiliaw

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.

rick3rt avatar May 06 '21 15:05 rick3rt

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.

This does the same as my solution, except it discards all errors.

Webbeh avatar May 06 '21 15:05 Webbeh

@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

rick3rt avatar May 06 '21 16:05 rick3rt

Do it in line 388 instead : if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { instead of if (code === STATUS_CODE.OK)

That didnt work for me, local -> remote still not uploading and getting popup error.

But this did!

Jany-M avatar May 06 '21 16:05 Jany-M

Another "same here", updated to latest VS Code and suddenly had this issue. Been using it for a couple years now.

dvelopin avatar May 07 '21 14:05 dvelopin