ginuerzh/gost · error
accpet on closed listener
Error message
accpet on closed listener
What it means
Returned by sshTunnelListener.Accept when its errChan is closed and no value was received — the tunnel's error channel has been shut down, so the listener can no longer produce connections or errors. It is the sentinel for accept-after-close on the SSH tunnel listener (note the misspelling 'accpet' in the message).
Source
Thrown at ssh.go:835
default:
log.Log("[ssh] Unknown channel type:", t)
newChannel.Reject(ssh.UnknownChannelType, fmt.Sprintf("unknown channel type: %s", t))
}
}
}()
log.Logf("[ssh] %s <-> %s", conn.RemoteAddr(), conn.LocalAddr())
sc.Wait()
log.Logf("[ssh] %s >-< %s", conn.RemoteAddr(), conn.LocalAddr())
}
func (l *sshTunnelListener) Accept() (conn net.Conn, err error) {
var ok bool
select {
case conn = <-l.connChan:
case err, ok = <-l.errChan:
if !ok {
err = errors.New("accpet on closed listener")
}
}
return
}
// directForward is structure for RFC 4254 7.2 - can be used for "forwarded-tcpip" and "direct-tcpip"
type directForward struct {
Host1 string
Port1 uint32
Host2 string
Port2 uint32
}
func (p directForward) String() string {
return fmt.Sprintf("%s:%d -> %s:%d", p.Host2, p.Port2, p.Host1, p.Port1)
}
func getHostPortFromAddr(addr net.Addr) (host string, port int, err error) {View on GitHub (pinned to a33fdbf4c9)
Solutions
- Stop calling Accept after the tunnel listener is closed
- Re-establish the SSH tunnel and create a new listener if forwarding must continue
- Propagate the error so callers shut down their accept loops cleanly
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at ssh.go:835 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ginuerzh/gost@a33fdbf4c9 (2026-09-02).
Data as JSON: /api/errors/c9ebf7078d2604ab.
Report an issue: GitHub.