Discord API · error code

Discord error 50046: Invalid file uploaded

Permanent - do not retryHTTP 400Validation and request shape

Last verified against Discord Developer Docs - Opcodes and status codes

What Discord returns
Invalid file uploaded

What error 50046 means

Discord could not accept the file you uploaded because it is malformed for its purpose, not because of its size. For images used as emoji, avatars, banners, icons and stickers, Discord must be able to decode the image; a corrupt PNG, a file with the wrong extension, an unsupported format (for example WebP where only PNG/JPEG/GIF are accepted for that field, or a non-APNG/Lottie sticker), or a data URI with the wrong MIME prefix all produce 50046.

For message attachments, the multipart body must be well-formed: each file part named files[n] with a filename, and any attachments metadata in payload_json referencing the right index. A zero-byte file, a part with no filename, or a mismatch between the declared and actual file can also trigger this.

What it looks like

{
  "message": "Invalid file uploaded",
  "code": 50046
}

Why it happens

  • Corrupt or truncated image (download failed mid-way, wrong encoding)
  • Unsupported format for that field (emoji must be PNG/JPEG/GIF; stickers PNG/APNG/Lottie/GIF)
  • Data URI with wrong MIME type (data:image/png;base64 but the bytes are JPEG)
  • Multipart part missing a filename or misnamed (file instead of files[0])
  • Zero-byte upload

How to fix Discord error 50046

  1. 1Open the file locally to confirm it decodes; check the first bytes match the claimed format
  2. 2Convert to a supported format for that endpoint and set the matching MIME prefix in the data URI
  3. 3Name multipart parts files[0], files[1]... with filename attributes, and put JSON in payload_json
  4. 4Reject empty files before upload
  5. 5Log the exact Content-Type and length of each part you send

How to stop it recurring

Validate and normalize media in your pipeline (decode, re-encode to a known-good format, check dimensions and size) before it reaches Discord. Use your library's attachment helpers, which build the multipart body correctly, rather than constructing it by hand.

Media validation is cheapest at ingestion: decode, re-encode, and store a known-good normalized copy, then uploads to Discord never fail on format. The per-field format rules and size caps are on the Discord limits page; if your multipart body itself is malformed rather than the file, the error is 50035 naming the part.

Official reference: Discord Developer Docs - Opcodes and status codes. See all Discord error codes or the Discord limits and quotas.

Related codes

Error 50046 - quick answers

What does Discord error 50046 mean?

Discord could not accept the file you uploaded because it is malformed for its purpose, not because of its size.

How do I fix Discord error 50046?

1. Open the file locally to confirm it decodes; check the first bytes match the claimed format 2. Convert to a supported format for that endpoint and set the matching MIME prefix in the data URI 3. Name multipart parts files[0], files[1]... with filename attributes, and put JSON in payload_json 4. Reject empty files before upload 5. Log the exact Content-Type and length of each part you send

Should I retry after error 50046?

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.