sshnet / sshnet/SSH.NET

An error occurred, but no specific error code exists to describe the failure

Open
#1,735 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

Hi,

I'm getting the below error on various version ( including 2025.1.0 )

Unhandled exception occurred Renci.SshNet.Common.SshException: Failed to upload /2880389.xml to ./2880389.xml
---> Renci.SshNet.Common.SftpException: An error occurred, but no specific error code exists to describe the failure.
at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)
at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback, Boolean isAsync, CancellationToken cancellationToken)
at Renci.SshNet.SftpClient.InternalSynchronizeDirectories(String sourcePath, String destinationPath, String searchPattern, SftpSynchronizeDirectoriesAsyncResult asyncResult)
--- End of inner exception stack trace ---

I'm properly connected to the SFTP server:

Files in remote directory ./username: ["processing"]
Current working directory: /

And I'm able to successfully upload a file using lftp:

lftp -u username sftp://some_server.com -e "put /tmp/test.xml -o /test5.xml; bye"

I don't have problems downloading files from this server.

Telnet to the server reoprts:

SSH-2.0-DataPowerSSH_1.1

I've been trying both:

SftpClient.Upload and SftpClient.SynchronizeDirectories(sourcePath, ".", "*.xml")

Any idea what might be causing the problem?
Tried to specify the remote path as / , ./ and ./username

Thanks

edi1
Maybe debug logs will be useful and also the fact, the server only supports: ssh-rsa

info: Renci.SshNet.Connection.DirectConnector[0]
Initiating connection to 'Unspecified/some_server.com:22'.
info: Renci.SshNet.Session[0]
Server version 'SSH-2.0-DataPowerSSH_1.1'.
dbug: Renci.SshNet.Session[0]
[(null)] Performing curve25519-sha256 key exchange.
dbug: Renci.SshNet.Security.KeyExchangeECCurve25519[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Creating aes128-ctr server cipher.
dbug: Renci.SshNet.Security.KeyExchangeECCurve25519[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Creating aes128-ctr client cipher.
dbug: Renci.SshNet.Security.KeyExchangeECCurve25519[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Creating hmac-sha2-256 server hmac algorithm.
dbug: Renci.SshNet.Security.KeyExchangeECCurve25519[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Creating hmac-sha2-256 client hmac algorithm.
dbug: Renci.SshNet.SftpClient[0]
Disposing client.
info: Renci.SshNet.SftpClient[0]
Disconnecting client.
dbug: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Disposing session.
info: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Disconnecting session.
dbug: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Shutting down socket.
dbug: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Disposing socket.
dbug: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Disposed socket.
info: Renci.SshNet.Session[0]
[5ACDE0EBBF5E5D1ACBF0B8452F18745B0D6126EFB878BD01C445FCD9FD937224] Raised exception
Renci.SshNet.Common.SshConnectionException: Software caused connection abort
---> System.Net.Sockets.SocketException (53): Software caused connection abort
at Renci.SshNet.Abstractions.SocketAbstraction.Read(Socket socket, Byte[] buffer, Int32 offset, Int32 size, TimeSpan readTimeout)
at Renci.SshNet.Session.TrySocketRead(Socket socket, Byte[] buffer, Int32 offset, Int32 length)
at Renci.SshNet.Session.ReceiveMessage(Socket socket)
at Renci.SshNet.Session.MessageListener()
--- End of inner exception stack trace ---

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Renci.SshNet.Sftp.SftpSession.RequestClose and trace the upload path through SftpClient.InternalUploadFile and InternalSynchronizeDirectories. Reproduce the failure against the reported DataPowerSSH server using the supplied logs and compare it with a successful lftp upload. Done means the cause is isolated and the upload either works or reports a specific, actionable failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.