Skip to main content
When the gateway closes a connection, it sends a close code indicating why. Some close codes are recoverable (the client should reconnect), while others are not.

Close code reference

CodeNameDescriptionReconnect
4000UNKNOWN_ERRORUnknown error occurredYes
4001UNKNOWN_OPCODESent an invalid gateway opcodeYes
4002DECODE_ERRORSent an invalid payloadYes
4003NOT_AUTHENTICATEDSent a payload before identifyingYes
4004AUTHENTICATION_FAILEDAccount token is invalidNo
4005ALREADY_AUTHENTICATEDSent more than one identify payloadYes
4007INVALID_SEQSent an invalid sequence when resumingYes
4008RATE_LIMITEDSending payloads too quicklyYes
4009SESSION_TIMEOUTSession timed out; reconnect and start a new oneYes
4010INVALID_SHARDSent an invalid shard when identifyingNo
4011SHARDING_REQUIREDSession would have handled too many guilds; sharding is requiredNo
4012INVALID_API_VERSIONSent an invalid gateway versionNo