{"record":{"id":"bae911c7eb95ac17","repo":"ginuerzh/gost","slug":"session-is-dead","errorCode":null,"errorMessage":"session is dead","messagePattern":"session is dead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ssh.go","lineNumber":30,"sourceCode":"\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/go-log/log\"\n\t\"golang.org/x/crypto/ssh\"\n)\n\n// Applicable SSH Request types for Port Forwarding - RFC 4254 7.X\nconst (\n\tDirectForwardRequest       = \"direct-tcpip\"         // RFC 4254 7.2\n\tRemoteForwardRequest       = \"tcpip-forward\"        // RFC 4254 7.1\n\tForwardedTCPReturnRequest  = \"forwarded-tcpip\"      // RFC 4254 7.2\n\tCancelRemoteForwardRequest = \"cancel-tcpip-forward\" // RFC 4254 7.1\n\n\tGostSSHTunnelRequest = \"gost-tunnel\" // extended request type for ssh tunnel\n)\n\nvar errSessionDead = errors.New(\"session is dead\")\n\n// ParseSSHKeyFile parses ssh key file.\nfunc ParseSSHKeyFile(fp string) (ssh.Signer, error) {\n\tkey, err := os.ReadFile(fp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ssh.ParsePrivateKey(key)\n}\n\n// ParseSSHAuthorizedKeysFile parses ssh Authorized Keys file.\nfunc ParseSSHAuthorizedKeysFile(fp string) (map[string]bool, error) {\n\tauthorizedKeysBytes, err := os.ReadFile(fp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tauthorizedKeysMap := make(map[string]bool)\n\tfor len(authorizedKeysBytes) > 0 {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/ginuerzh/gost/blob/a33fdbf4c98034f4bfeeaea9868909822b9c526d/ssh.go#L12-L48","documentation":"errSessionDead is a sentinel error returned by the SSH forward transporters when the cached sshSession for the target address is found in the session map but its underlying SSH connection is already closed; the dead entry is removed from the map before returning. It means the pooled SSH tunnel went away and the requested forward cannot be delivered over it.","triggerScenarios":"Thrown at ssh.go:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat the error as a signal to re-establish the SSH session and retry the forward request","Check network connectivity and SSH server availability that caused the session to drop","Enable SSH keep-alives so dead sessions are detected and evicted earlier"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a33fdbf4c98034f4bfeeaea9868909822b9c526d","analyzedAt":"2026-09-02T22:15:54.506Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}