Errors

SSHKitError

public struct SSHKitError: Error, Equatable, LocalizedError, Sendable {
    public var code: Int
    public var message: String

    public init(code: Int, message: String)
    public var errorDescription: String? { get }
}

public typealias SSHError = SSHKitError

code is an Int, not the enum, so unknown bridged errors from Obj-C still round-trip. Compare against SSHKitErrorCode.X.rawValue when you need to branch.

SSHKitErrorCode

CodeCaseMeaning
1unavailableOperation completed without a result, or feature is unsupported.
2invalidStateCaller passed invalid input or violated the connection state machine.
3connectionFailedTCP, proxy, or libssh transport setup failed.
4authenticationFailedServer rejected the supplied credentials.
5commandFailedStreamed channel / SCP protocol broke. Not used for command non-zero exit — that is reported via SSHCommandResult.exitStatus.
6hostKeyVerificationFailedHost key did not match the active SSHHostKeyPolicy.
7cancelledOperation was cancelled via Task cancellation or close().
8sftpFailureGeneric SFTP failure not covered by the cases below.
9sftpFileNotFoundSFTP server returned a "no such file" status.
10sftpPermissionDeniedSFTP server returned a permission-denied status.
11sftpNoSpaceSFTP server returned a no-space status.