- Symptom
- Gateway closed with code 4004 Authentication failed401: Unauthorized on every REST callBot worked an hour earlier and nothing changed in the hosting
- Cause
- Discord bot tokens are a GitHub secret scanning partner pattern, so a token in a public commit, gist, issue or npm package is reported straight to Discord. The provider can revoke it, and the bot then fails with an authentication error.
- Fix
- Reset the token in the Developer Portal, store it as a deploy secret, and scrub it from git history. Enable push protection on the repository.
- Apply
https://discord.com/developers/applications > your app > Bot > Reset Token > store the new value in the host's secret manager- Affected
- Discord bot tokens found in public GitHub content, as of 2026-10
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders