Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renci.SshNet.Common.SshException: Failed to open local file #1309

Open
paritoshnagar2016 opened this issue Feb 6, 2024 · 1 comment
Open

Comments

@paritoshnagar2016
Copy link

I have been seeing below error while downloading file from SFTP and I am unsure why it throw below exception, what does that signifies?

Renci.SshNet.Common.SshException: Failed to open local file
at Renci.SshNet.Common.AsyncResult.EndInvoke()
at Renci.SshNet.Sftp.SftpSession.EndOpen(SftpOpenAsyncResult asyncResult)
at Renci.SshNet.ServiceFactory.CreateSftpFileReader(String fileName, ISftpSession sftpSession, UInt32 bufferSize)
at Renci.SshNet.SftpClient.InternalDownloadFile(String path, Stream output, SftpDownloadAsyncResult asyncResult, Action`1 downloadCallback)

@Rob-Hague
Copy link
Collaborator

I think that message "Failed to open local file" is coming from your server, so you might start there if you have access.

You might be able to get some more information from the client-side but unfortunately it's not easy with the current version. I think basically you are receiving a SftpStatusResponse defined here:

https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs

The ErrorMessage property corresponds to your "Failed to open local file message" message. The StatusCode property might contain more pertinent information. Unfortunately all this stuff is internal currently, but you could probably access it with a local build of the library and some crafty debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants