You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m using a single SftpClient to download multiple files simultaneously. On one of a servers, I get "Invalid handle" error from time to time.
SSH.NET version 2024.2.0, .Net 9.
In connection logs I only see this version: Remote version: SSH-2.0-2.0
"HResult": -2146233088,
"Message": "Invalid handle.",
"Source": "Renci.SshNet",
"StackTrace": " at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)\r\n at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback)\r\n at Renci.SshNet.SftpClient.<>c__DisplayClass56_0.<BeginUploadFile>b__0()\r\n--- End of stack trace from previous location ---\r\n at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location ---\r\n
"TargetSite": "Void RequestClose(Byte[])",
"Type": "Renci.SshNet.Common.SshException"
at Renci.SshNet.Sftp.SftpSession.RequestClose(Byte[] handle)
at Renci.SshNet.SftpClient.InternalUploadFile(Stream input, String path, Flags flags, SftpUploadAsyncResult asyncResult, Action`1 uploadCallback)
at Renci.SshNet.SftpClient.<>c__DisplayClass56_0.<BeginUploadFile>b__0()
--- End of stack trace from previous location ---
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
Activity
Rob-Hague commentedon Nov 5, 2025
Please give it a try with 2025.1.0? There have been 2 relevant fixes since 2024.2.0: #1623 and #1643
m0a0k0s commentedon Nov 5, 2025
ok, I updated to 2025.1, will check next week
m0a0k0s commentedon Nov 18, 2025
Finally updated to 2025.1.0 with dsa rollbacked. Error is still reproducing.
juliannamello commentedon Dec 16, 2025
I'm encountering this as well. I tested with file upload
This code fails - not every single time, but pretty consistently:
I tried increasing
MaxDegreeOfParallelismto 16 in the above example and never saw an errorI also tried switching to synchronous execution and did not see an error:
Here are the exception details: