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

Error: failure

Open szymoneko opened this issue 6 years ago • 44 comments

Hi,

It's work excellente but after update i've problem:

[error] Error: Failure at SFTPStream._transform (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\sftp.js:412:27) at SFTPStream.Transform._read (_stream_transform.js:186:10) at SFTPStream._read (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\sftp.js:183:15) at SFTPStream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SFTPStream.Writable.write (_stream_writable.js:290:11) at Channel.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Channel.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Channel.Readable.push (_stream_readable.js:208:10) at SSH2Stream. (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2\lib\Channel.js:166:15) at emitOne (events.js:116:13) at SSH2Stream.emit (events.js:211:7) at parsePacket (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:3445:10) at SSH2Stream._transform (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:671:13) at SSH2Stream.Transform._read (_stream_transform.js:186:10) at SSH2Stream._read (.vscode\extensions\liximomo.sftp-1.6.3\node_modules\ssh2-streams\lib\ssh.js:253:15) at SSH2Stream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SSH2Stream.Writable.write (_stream_writable.js:290:11) at Socket.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:594:20)

szymoneko avatar Oct 17 '18 11:10 szymoneko

{ "protocol": "sftp", "host": "127.0.0.1", "port": 2222, "username": "...", "password": "...", "remotePath": "...", "watcher": { "files": "/*", "autoUpload": false, "autoDelete": false }, "uploadOnSave": true, "syncMode": "full", "ignore": [ "/.vscode", "/.git", "/.DS_Store" ] }

szymoneko avatar Oct 17 '18 12:10 szymoneko

It's work excellente. Which version? Does it work now? Downgrading Visual Studio Code extension.

but after update i've problem. Does this error always happen?

FYI. The failure error message comes from the remote side and is more or less the default/generic error message that SSH' sftp server sends when a syscall fails or similar. To know what exactly is going wrong you could try to enable debug output for the sftp server and then execute your transfers again and see what (if anything) shows up in the logs there.

liximomo avatar Oct 17 '18 12:10 liximomo

It doesn't work. Still the sam error.

Does this error always happen?

Always, after update.

Which version? Does it work now? Downgrading Visual Studio Code extension.

Example link: https://liximomo.gallery.vsassets.io/_apis/public/gallery/publisher/liximomo/extension/sftp/1.5.13/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage Is it ok?

szymoneko avatar Oct 18 '18 06:10 szymoneko

Ok, I've disabled extension autoupdate options and it's work on 1.5.13 version. There is a problem o 1.6 version.

szymoneko avatar Oct 18 '18 08:10 szymoneko

Can you provide the full logs of v1.6.3.

  1. Open User Settings.

    • On Windows/Linux - File > Preferences > Settings
    • On macOS - Code > Preferences > Settings
  2. Set sftp.printDebugLog to true and reload vscode.

  3. Reproduce the problem, get the logs from View > Output > sftp.

liximomo avatar Oct 18 '18 08:10 liximomo

https://pastebin.com/fjtZHq2m Full logs :)

szymoneko avatar Oct 18 '18 08:10 szymoneko

Sorry, can't see any errors.

liximomo avatar Oct 18 '18 09:10 liximomo

Sorry, can't see any errors.

At line 4116. [error] Error: Failure

szymoneko avatar Oct 18 '18 11:10 szymoneko

I have the same issues ! it's was workign fine before ! any news ?

bscript avatar Nov 01 '18 11:11 bscript

Got the same issue as well. https://pastebin.com/RGU5SmsA

philipaarseth avatar Nov 01 '18 16:11 philipaarseth

@szymoneko @bscript @philipaarseth https://github.com/liximomo/vscode-sftp/blob/master/FAQ.md#error-failure

liximomo avatar Nov 02 '18 01:11 liximomo

But I've go Windows 10

szymoneko avatar Nov 02 '18 06:11 szymoneko

I got it to work. It's part of my hosting file structure, I needed to put the full path, not just "remote-path": "/", but "remotePath": "/customers/c/4/d/domain.com/httpd.www/",

@liximomo maybe you could add it as a suggestion in the FAQ 👍

philipaarseth avatar Nov 02 '18 11:11 philipaarseth

I just installed version I can't get it to work with full remote path too. Always get error failure. It just downloads the folder and not any files.

aanjaneyam avatar Nov 02 '18 16:11 aanjaneyam

Ok now it seems to work. After I added syncmode:full, rewrote the remotepath and saved the sftp.json file. I then click Sync remote->local to download all the remote files to local environment. However, it still gave random error:failure couple of times after the password timed out and I pressed Sync remote->local again to continue the download. And then it started downloading again. It gets stuck with long sync as needs password all the time. Is it possible to cache or store the password in the simple config (not profiles).

aanjaneyam avatar Nov 02 '18 16:11 aanjaneyam

Possible solution:

I had the same issue. As it seemed, my problem was my remotePath /home/edwin/projects/website contained a symlink, that was not handled well, resulting in [error] Error: Failure.

Changing the remote path to the actual path the symlink was linking to, /usr/share/nginx/website solved this.

Eddy805 avatar Jan 17 '19 08:01 Eddy805

Yeah we are having the same problem with symlinks here. Strangely using the symlink works for me but not for my colleague. Both same setup:

_Vscode Version _SFTP Extension Version _sftp.json file

sebastianjung avatar Jan 24 '19 14:01 sebastianjung

symbolic Link directory ?

sdir avatar Jan 25 '19 03:01 sdir

@sdir Yeah, like so:

"/project-a/public"

where public is the symlink directory

sebastianjung avatar Jan 25 '19 11:01 sebastianjung

Possible solution:

I had the same issue. As it seemed, my problem was my remotePath /home/edwin/projects/website contained a symlink, that was not handled well, resulting in [error] Error: Failure.

Changing the remote path to the actual path the symlink was linking to, /usr/share/nginx/website solved this.

I have same issues and change symlink to hard link solve this problem. But I use symlink directory before, It works. And suddenly, it failed. Wired.

qhsong avatar Mar 08 '19 08:03 qhsong

In my case

use symlink path: some file upload fail use absolute path: everything is all right (until now)

Shaffron avatar Mar 19 '19 00:03 Shaffron

I face the same issue. List directory works fine but file upload wont work.

Error: Failure sftp.js:412 at SFTPStream._transform (c:\SURESH\vsoncode\NodeCode\algorithmserviceGL\node_modules\ssh2-streams\lib\sftp.js:412:27) at SFTPStream.Transform._read (_stream_transform.js:186:10) at SFTPStream._read (c:\SURESH\vsoncode\NodeCode\algorithmserviceGL\node_modules\ssh2-streams\lib\sftp.js:183:15) at SFTPStream.Transform._write (_stream_transform.js:174:12) at doWrite (_stream_writable.js:387:12) at writeOrBuffer (_stream_writable.js:373:5) at SFTPStream.Writable.write (_stream_writable.js:290:11) at Channel.ondata (_stream_readable.js:639:20) at emitOne (events.js:116:13) at Channel.emit (events.js:211:7)

My code

var conn = new Client(); conn.on('ready', function() { conn.sftp(function(err, sftp) { if (err) throw err;

			var fs = require("fs"); // Use node filesystem
			var readStream = fs.createReadStream( "C:/Users/path/file.txt" );
			var writeStream = sftp.createWriteStream( remotePathToList );

			writeStream.on('close',function () {
				console.log( "- file transferred succesfully" );
			});

			writeStream.on('end', function () {
				console.log( "sftp connection closed" );
				conn.close();
			});

			// initiate transfer of file
			readStream.pipe( writeStream );
		});
	}).connect(connSettings);

srshue avatar May 24 '19 17:05 srshue

I have the same "Error: Failure" issue.

  • OS: Mac
  • VSCode Version 1.39.2
  • Extension Version 1.12.9

Suggestions above didn't help. Remote path is absolute.

config

{
	"name": "project",
	"host": "192.168.10.10",
	"protocol": "sftp",
	"port": 22,
	"username": "*****",
	"password": "*****",
	"remotePath": "/opt/applications/project",
	"ignore": [".vscode", ".git", "node_modules", ".DS_Store"],
	"uploadOnSave": false,
	"watcher": {
		"files": "**/*",
		"autoUpload": true,
		"autoDelete": true
	}
}

sftp.log (look to the end of file)

Any suggestions? ~p.s. the problem appeared recently before vscode 1.39 update I guess.~

Update ~Checked on previous versions of vscode up to 1.37.0 / sftp 1.12.0 - the same issue. Looks like the problem might be somewhere else. But it appears and repeats only after changing git branch. Any further attempts to sync to remote ends the same way. But if I clean remote folder before run sync - all work or, sync completes successful. But again, any further branch change will break sync, and only one way to fix is completely cleanup destination folder on remote to properly sync again. Can't tell why this happen, but I've found that branches may differ by existence of symbolic (shortcuts) link files. ~

~@szymoneko, can you please check if folders with symbolic links syncs fine when changing branches?~

Update 2 Disabling watcher solves the issue, but now I have to run sync manually each time. So it appears to be an issue with watcher right during switching branches.

Update 3 Looks like symbolic links persistent really matters, or idk what else. Because now even manual sync Failure

[10-24 13:18:21] [error] Error: Failure
	at SFTPStream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:412:27)
	at SFTPStream.Transform._read (_stream_transform.js:190:10)
	at SFTPStream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/sftp.js:183:15)
	at SFTPStream.Transform._write (_stream_transform.js:178:12)
	at doWrite (_stream_writable.js:410:12)
	at writeOrBuffer (_stream_writable.js:394:5)
	at SFTPStream.Writable.write (_stream_writable.js:294:11)
	at Channel.ondata (_stream_readable.js:666:20)
	at Channel.emit (events.js:182:13)
	at addChunk (_stream_readable.js:283:12)
	at readableAddChunk (_stream_readable.js:264:11)
	at Channel.Readable.push (_stream_readable.js:219:10)
	at SSH2Stream.<anonymous> (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2/lib/Channel.js:167:15)
	at SSH2Stream.emit (events.js:182:13)
	at parsePacket (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:3288:10)
	at SSH2Stream._transform (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:694:13)
	at SSH2Stream.Transform._read (_stream_transform.js:190:10)
	at SSH2Stream._read (/Users/usr/.vscode/extensions/liximomo.sftp-1.12.9/node_modules/ssh2-streams/lib/ssh.js:253:15)
	at SSH2Stream.Transform._write (_stream_transform.js:178:12)
	at doWrite (_stream_writable.js:410:12)
	at writeOrBuffer (_stream_writable.js:394:5)
	at SSH2Stream.Writable.write (_stream_writable.js:294:11)
	at Socket.ondata (_stream_readable.js:666:20)
	at Socket.emit (events.js:182:13)
	at addChunk (_stream_readable.js:283:12)
	at readableAddChunk (_stream_readable.js:264:11)
	at Socket.Readable.push (_stream_readable.js:219:10)
	at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) when local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/simplesamlphp/simplesamlphp/locales/no
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/project/packing_slip.php
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/bin/export-plural-rules
[10-24 13:18:21] [info] local ➞ remote /Users/usr/Documents/work/Git/project/php-lib/tools/vendor/bin/export-plural-rules.php

esemlabel avatar Oct 17 '19 13:10 esemlabel

Thanks Man! It worked perfectly!

joaovitordpf avatar Oct 22 '19 13:10 joaovitordpf

Possible Culprit: No More Drive Space. I found that I was getting this nondescript error because I was out of drive space. I cleared out the runaway logs folder and freed up 40GB of uselessness and power-cycled the server. Problem solved. That is to say that the issue was not vscode-sftp, but rather my own carelessness in monitoring my server log consumption.

Proposal: Enhance error messaging in sftp.js Is there a way to capture disc space and report it to the user when there is an error like this?

clayperez avatar Jan 20 '20 22:01 clayperez

200Gigs free space. So that is not a reason in my case.

esemlabel avatar Jan 21 '20 10:01 esemlabel

Had a similar issue. Found the problem to be the "remotePath" was pointing to a symlink on Linux server. When changed to the actual path, problem solved.

cloudqubes avatar Jan 29 '20 12:01 cloudqubes

@cloudqubes, that is not my case. "remotePath" is set to absolute.

esemlabel avatar Jan 29 '20 13:01 esemlabel

I have the same issue with symlink in "remotePath". It works only with real path. Additionally SFTP browser doesn't show symlink directories on server in list.

sergei-beloglazov avatar Jan 31 '20 08:01 sergei-beloglazov

Good day to all

I had the same problem, but I fixed it with the absolute path.

I also want to indicate that this problem does not occur in subdomains only in the main domain.

Greetings from Colombia co

egoan82 avatar Apr 21 '20 16:04 egoan82