Skip to content

Opus Decode Errors #2921

@atmaranto

Description

@atmaranto

Summary

Occasionally, Opus decode errors will prevent getting sane audio data from stream

Reproduction Steps

This bug occurs inconsistently. Simply connecting to a voice channel and trying to receive data with start_recording is enough to cause it to occur, but sometimes, I'll start a voice channel with no issue. My assumption is there is some underlying internal inconsistency in what format Discord is using, and when it chooses a particular format, it fails. This is occurring with master and the most recent release candidate.

Minimal Reproducible Code

Expected Results

Like in previous versions, the audio to record without error.

Actual Results

Note: this error only appeared after I manually added a traceback.print_exc line in opus.py:

Traceback (most recent call last):
  File "/home/user/miniconda3/lib/python3.13/site-packages/discord/opus.py", line 549, in run
    data.decoded_data = self.get_decoder(data.ssrc).decode(
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        data.decrypted_data
        ^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/user/miniconda3/lib/python3.13/site-packages/discord/opus.py", line 514, in decode
    ret = _lib.opus_decode(
        self._state, data, len(data) if data else 0, pcm_ptr, frame_size, fec
    )
  File "/home/user/miniconda3/lib/python3.13/site-packages/discord/opus.py", line 131, in _err_lt
    raise OpusError(result)
discord.opus.OpusError: corrupted stream

Intents

intents = discord.Intents.default(); intents.members = True

System Information

  • Python v3.13.2-final
  • py-cord v2.7.None-candidate
    • py-cord importlib.metadata: v2.7.0rc1
  • aiohttp v3.12.6
  • system info: Linux 6.12.41+deb13-amd64 Update README.rst #1 SMP PREEMPT_DYNAMIC Debian 6.12.41-1 (2025-08-12)

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions