Discord API · error code

Discord error 50161: Voice messages must have supporting metadata

Permanent - do not retryHTTP 400Validation and request shape

Last verified against Discord Developer Docs - Opcodes and status codes

What Discord returns
Voice messages must have supporting metadata.

What error 50161 means

The voice message's audio attachment is missing the metadata Discord uses to display it. Voice message attachments carry two extra fields: duration_secs, the length of the audio in seconds, and waveform, a base64-encoded byte array used to draw the waveform in the client.

Bots that add the IS_VOICE_MESSAGE flag to an ordinary audio upload, without filling in those attachment fields, get 50161. Discord does not compute them for you from the file.

The values should describe the actual audio. Compute the duration from the file with an audio library, and derive the waveform by sampling the audio's amplitude into a short array of bytes. Audio that has no readable duration at all fails with a separate code, 50192.

What it looks like

{
  "message": "Voice messages must have supporting metadata.",
  "code": 50161
}

Why it happens

  • Attachment object missing duration_secs
  • Attachment object missing waveform
  • Metadata placed on the message instead of the attachment object
  • Library version that does not support voice message fields
  • Duration computed from a different file than the one uploaded, for example before transcoding

How to fix Discord error 50161

  1. 1Add duration_secs and waveform to the attachment entry in payload_json
  2. 2Compute duration from the audio file rather than hard-coding it
  3. 3Encode the waveform bytes as base64
  4. 4Retry and confirm the client shows a waveform and duration
  5. 5If you transcode audio, compute metadata from the final file you upload

How to stop it recurring

Generate the metadata at the point where you create or convert the audio, and store it with the file so every send has it available. Keep voice messages on a dedicated code path; related rules are covered on 50160 and 50159.

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

Related codes

Error 50161 - quick answers

What does Discord error 50161 mean?

The voice message's audio attachment is missing the metadata Discord uses to display it. Voice message attachments carry two extra fields: duration_secs , the length of the audio in seconds, and waveform , a base64-encoded byte array used to draw the waveform in the client. Bots that add the IS_VOICE_MESSAGE flag to an ordinary audio upload, without filling in those attachment fields, get 50161.

How do I fix Discord error 50161?

1. Add duration_secs and waveform to the attachment entry in payload_json 2. Compute duration from the audio file rather than hard-coding it 3. Encode the waveform bytes as base64 4. Retry and confirm the client shows a waveform and duration 5. If you transcode audio, compute metadata from the final file you upload

Should I retry after error 50161?

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.