vscode-sftp: No Such File error on trying sftp:download

Expected Behavior

When right click on a folder/file and click SFTP Download, should download the folder/file

Actual Behavior

Getting Error “No such File” Log:

[info] config at d:\code\ems {"remotePath":"/home/frappe/frappe-bench/apps/","uploadOnSave":true,"downloadOnOpen":false,"syncMode":"update","ignore":[".vscode",".git",".DS_Store"],"watcher":{"files":false,"autoUpload":false,"autoDelete":false},"concurrency":4,"protocol":"sftp","host":"127.0.0.1","port":3021,"username":"******","password":"******","connectTimeout":10000,"interactiveAuth":false,"sshConfigPath":"~/.ssh/config","secure":false,"passive":false,"context":"d:\\code\\ems"}
[trace] execute download for d:\code\ems
[error] Error: No such file
	at SFTPStream._transform (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2-streams\lib\sftp.js:412:27)
	at SFTPStream.Transform._read (_stream_transform.js:167:10)
	at SFTPStream._read (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2-streams\lib\sftp.js:183:15)
	at SFTPStream.Transform._write (_stream_transform.js:155:12)
	at doWrite (_stream_writable.js:329:12)
	at writeOrBuffer (_stream_writable.js:315:5)
	at SFTPStream.Writable.write (_stream_writable.js:241:11)
	at Channel.ondata (_stream_readable.js:557:20)
	at emitOne (events.js:96:13)
	at Channel.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Channel.Readable.push (_stream_readable.js:136:10)
	at SSH2Stream.<anonymous> (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2\lib\Channel.js:166:15)
	at emitOne (events.js:96:13)
	at SSH2Stream.emit (events.js:191:7)
	at parsePacket (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2-streams\lib\ssh.js:3445:10)
	at SSH2Stream._transform (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2-streams\lib\ssh.js:671:13)
	at SSH2Stream.Transform._read (_stream_transform.js:167:10)
	at SSH2Stream._read (C:\Users\chirag\.vscode\extensions\liximomo.sftp-1.3.0\node_modules\ssh2-streams\lib\ssh.js:253:15)
	at SSH2Stream.Transform._write (_stream_transform.js:155:12)
	at doWrite (_stream_writable.js:329:12)
	at writeOrBuffer (_stream_writable.js:315:5)
	at SSH2Stream.Writable.write (_stream_writable.js:241:11)
	at Socket.ondata (_stream_readable.js:557:20)
	at emitOne (events.js:96:13)
	at Socket.emit (events.js:191:7)
	at readableAddChunk (_stream_readable.js:178:18)
	at Socket.Readable.push (_stream_readable.js:136:10)
	at TCP.onread (net.js:560:20)

Steps to Reproduce the Problem

This happened after I updated VS Code today.

  1. Right click any file / folder in Explorer
  2. Click SFTP: download

Specifications

  • Version: image sftp version: 1.3.0
  • Platform: Windows 10 64 bit

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 45 (1 by maintainers)

Most upvoted comments

I’ve got a similar issue of “No such file” when uploading files. But the file is successfully synced in fact.

vscode version: 1.56.0 sftp plugin version: 1.12.9

No such issue when using previous vscode version(1.55.*)

The exception logs are quite similar as those above:

[05-07 10:49:32] [error] Error: No such file
	at SFTPStream._transform (c:\Users\Johnson\.vscode\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 (c:\Users\Johnson\.vscode\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.<anonymous> (c:\Users\Johnson\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2\lib\Channel.js:167:15)
	at SSH2Stream.emit (events.js:315:20)
	at parsePacket (c:\Users\Johnson\.vscode\extensions\liximomo.sftp-1.12.9\node_modules\ssh2-streams\lib\ssh.js:3288:10)
	at SSH2Stream._transform (c:\Users\Johnson\.vscode\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 (c:\Users\Johnson\.vscode\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 e:\Desktop\PROJNAME\src\test.py

I believe this comes from the 1.56.0 version of VS code. I downgraded to 1.55.2 and it now works. https://code.visualstudio.com/updates/v1_55

EDIT: And disable auto-updates on VS code so that it won’t go back to 1.56.0 by itself 😃

This worked for me without downgrading

https://github.com/liximomo/vscode-sftp/issues/919#issuecomment-838586635

Nice - thanks @sdir. Guess I could have figured that if I thought about it.

So to sum up all the above as TLDR for others skimming this thread:

Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

Add options.autoDestroy = false; after both instances.

Editing the file: ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js change the line 388: if (code === STATUS_CODE.OK) { to: if (code === STATUS_CODE.OK || code === STATUS_CODE.NO_SUCH_FILE) { Reload vscode It is not the most correct option but it works.

Seems a solution without downgrading here.

This worked for me without downgrading

#919 (comment)

Nice - thanks @sdir. Guess I could have figured that if I thought about it.

So to sum up all the above as TLDR for others skimming this thread:

Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

Add options.autoDestroy = false; after both instances.

IT WORK MODERFOKER!!! THANKYOU!!!

This worked for me without downgrading

#919 (comment)

Nice - thanks @sdir. Guess I could have figured that if I thought about it.

So to sum up all the above as TLDR for others skimming this thread:

Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

Add options.autoDestroy = false; after both instances.

It worked! Thank you so much!!!

Guys lets stop adding more “same here, downgrade worked” comments…

The new actually relevant issue is #919

Also: lets face it, this project seems abandoned, the last commit is 2 years old. The actual problem / bug is in the ssh2-streams library, which I think also won’t get any updates, like the author mentioned:

The upcoming release doesn’t use ssh2-streams anymore so it won’t be an issue.

The choices at the moment are: try the current master branch as that is where development is focused or use a fork of ssh2 v0.8.x with the changes you need.

I believe this comes from the 1.56.0 version of VS code. I downgraded to 1.55.2 and it now works. https://code.visualstudio.com/updates/v1_55

In fact, I tried your solution and resolved the question. But then I installed an extension called “Latex Workshop” and compiled my document, then the same question show up again! There must be something wrong with “Latex Workshop”

same issue here.

Could you provide the 1.2.7.vsix file so we can at least rollback in the meantime?

Just use my version that implement the new ssh2 v1.1.0 version that fix every problem 🙂 https://github.com/Natizyskunk/vscode-sftp/releases

This worked for me without downgrading

#919 (comment)

Nice - thanks @sdir. Guess I could have figured that if I thought about it.

So to sum up all the above as TLDR for others skimming this thread:

Do a search inside ~/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js for options.emitClose = false;

Add options.autoDestroy = false; after both instances.

ITS WORKING ! Thank you So much!

Same happening here. Win 10 x64, started on 1.56.0. Downgrade to 1.55.2 works OK.

Same issue here

I believe this comes from the 1.56.0 version of VS code. I downgraded to 1.55.2 and it now works. https://code.visualstudio.com/updates/v1_55

Same, it is now working in 1.3.1.

@liximomo Nope, in my case update to 1.3.1 has resolved the issue.

Same issue for both commands: Download or Sync to Local Simultaneously SFTP:List is working absolutely fine and correctly displaying all directories and files.