HTTP 400 · Bad Request
HTTP 400 Users & Peers

When & why it happens

The supplied peer (user/chat/channel id) is unknown to the server — usually a stale or wrongly-resolved InputPeer.

Handling in gogram

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

if err, ok := err.(*gogram.ErrResponseCode); ok { if err.Message == "PEER_ID_INVALID" { // handle this error } }