Repository navigation
Description
Summary
Any voice-only message on Discord (audio attachment with no accompanying text) crashes the entire message handler. The agent never replies. Looks like an STT/OpenAI failure but it is a plain Python unpacking bug — independent of STT provider, auth, or quota.
Error
ERROR gateway.platforms.base: [Discord] Error handling message: too many values to unpack (expected 2)
Traceback (most recent call last):
...
File "gateway/run.py", line 7378, in _prepare_inbound_message_text
message_text, _successful_transcripts = await self._enrich_message_with_transcription(
ValueError: too many values to unpack (expected 2)
Root cause
_enrich_message_with_transcription is declared -> tuple[str, List[str]] and all four call sites unpack two values. But one return branch still returns a bare string — the leftover from when the function returned -> str.
In gateway/run.py, the success block (transcription produced):
_placeholder = "(The user sent a message with no text content)"
if user_text and user_text.strip() == _placeholder:
return prefix # <-- BUG: bare str
if user_text:
return f"{prefix}\n\n{user_text}", successful_transcripts
return prefix, successful_transcriptsThe failure block right above it handles the identical branch correctly (return prefix, []), so this is clearly a missed conversion. When user_text equals the Discord adapter's empty-content placeholder (i.e. a voice-only message) and transcription succeeded, return prefix returns a string; the caller does a, b = "<string>", which unpacks the string's characters and raises.
Reproduction
- Discord adapter, STT enabled and working.
- Send a voice note with no text caption to the bot.
- Handler crashes with the error above; no reply is sent. (A voice note with a text caption works, because it takes the
if user_text:branch.)
Fix
One line — mirror the sibling returns:
if user_text and user_text.strip() == _placeholder:
- return prefix
+ return prefix, successful_transcriptssuccessful_transcripts is in scope and is exactly what the two following returns already use.
Environment
- Version: 0.16.0 (HEAD
a77efada5) - Still present on
origin/main(the barereturn prefixis unchanged in the latest commit). - Platform: Discord adapter. Latent since the function was refactored from
-> strto the 2-tuple return; only fatal once callers started unpacking.
Activity
liuhao1024 commentedon Jun 9, 2026
This is fixed by #42710 — returns
(prefix, successful_transcripts)from the voice-only transcription placeholder branch instead of a bare string.kshitijk4poor commentedon Jun 10, 2026
Fixed by #42090 (merged in 9ca9697). The bare
return prefixin the placeholder branch of_enrich_message_with_transcriptionnow returns the(prefix, successful_transcripts)tuple, with a regression test covering the captionless-voice-note path. Thanks for the precise root-cause diagnosis.