HTTP 400 · Bad Request
HTTP 400 Authentication Parameterized

When & why it happens

The current session was created less than 24h ago and is not allowed to perform this sensitive action yet. Wait the supplied seconds.

Parameterized error

The wire code carries a parameter on its tail (literal you'll see: SESSION_TOO_FRESH_42). Gogram parses it out and stores it on ErrResponseCode.AdditionalInfo with the right type.

Handling in gogram

Surfaced as *gogram.ErrResponseCode. Match on the message:

if err, ok := err.(*gogram.ErrResponseCode); ok { if strings.HasPrefix(err.Message, "SESSION_TOO_FRESH") { secs := err.AdditionalInfo.(int) time.Sleep(time.Duration(secs) * time.Second) // retry } }