SftpClient.Create thows SshException instead of SftpPathNotFoundException when directories don't exist
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 993
- Avg merge
- 9d 21h
- Merged PRs (30d)
- 1
Description
SftpClient.Create documentation states it throws SftpPathNotFoundException if
The specified path is invalid, or its directory was not found on the remote host.
However, when I try to create a file at an non-existing path I get SshException with "Folder not found" message with stack trace starting at SftpSession.RequestOpen. Not only this is confusing and doesn't match documented behavior, but also SshException is too generic to handle this particular case (e.g. create the directory and try again).
Below is the content of the response object:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure through SftpClient.Create with a missing remote directory, then trace the stack from SftpSession.RequestOpen. Compare the observed SshException with the documented SftpPathNotFoundException behavior; done means the missing-directory case produces the documented specific exception and regression coverage verifies it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100