Discord error 40005: Request entity too large
Last verified against Discord Developer Docs - Opcodes and status codes
Request entity too large. Try sending something smaller in sizeWhat error 40005 means
The total size of the HTTP request exceeded what Discord will accept. This is about bytes on the wire, not field lengths. The common trigger is file uploads: the default attachment limit is 10 MiB per request for bots (it can be higher only in boosted servers, and Nitro limits apply to users, not to bots). A 12 MB screenshot or a short video will be rejected before Discord even looks at the JSON.
It can also happen without files. A JSON payload that embeds a large base64 image (for example in an avatar or emoji image field, or a sticker upload) counts toward the request size. And bulk requests that pack many embeds with long descriptions can approach the limit.
Compare with 50045, which is Discord's own "file exceeds the maximum size" check after parsing; which one you see depends on where the oversize is detected.
What it looks like
{
"message": "Request entity too large",
"code": 40005
}Why it happens
- Attachment over the server's upload limit (10 MiB default for non-boosted servers)
- Large base64 image in a JSON field (avatar, emoji, sticker, role icon)
- Multiple attachments whose combined size exceeds the limit
- Excessively large JSON body (many embeds, long components payload)
How to fix Discord error 40005
- 1Check the file size before uploading; compress images, transcode video, or upload to external storage and post a link
- 2Read the guild's premium_tier from GET /guilds/{id} to learn whether a higher upload limit applies
- 3Split multiple attachments across several messages
- 4For emoji and avatar images, resize to the documented maximum (for example 256 KB for emoji) before base64-encoding
How to stop it recurring
Enforce size limits in your own upload path with a hard ceiling below Discord's default (for example 9 MiB), and surface a clear error to the user. Where files are user-supplied, validate size before the bot ever touches the Discord API.
Upload budgets by destination, plus the smaller caps for emoji, stickers and icons, are collected on the Discord limits page. When the oversize is caught after parsing instead of at the transport, you get 50045, so handle the two codes in the same branch.
Official reference: Discord Developer Docs - Opcodes and status codes. See all Discord error codes or the Discord limits and quotas.
Related codes
Error 40005 - quick answers
What does Discord error 40005 mean?
The total size of the HTTP request exceeded what Discord will accept. This is about bytes on the wire, not field lengths. The common trigger is file uploads: the default attachment limit is 10 MiB per request for bots (it can be higher only in boosted servers, and Nitro limits apply to users, not to bots). A 12 MB screenshot or a short video will be rejected before Discord even looks at the JSON.
How do I fix Discord error 40005?
1. Check the file size before uploading; compress images, transcode video, or upload to external storage and post a link 2. Read the guild's premium_tier from GET /guilds/{id} to learn whether a higher upload limit applies 3. Split multiple attachments across several messages 4. For emoji and avatar images, resize to the documented maximum (for example 256 KB for emoji) before base64-encoding
Should I retry after error 40005?
No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.
Stop debugging Discord by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.