Skip to content

[Bug]: TTS doesn't work with Matrix (Synapse) because of missing Content-Length #4339

@pjay-io

Description

@pjay-io

Bug Description

After enabling all TTS and STT settings and sending /voice on in a Matrix DM, the agent was not responding with TTS and no errors were shown. After some digging this is what is logged in ~/.hermes/logs/error.log:

2026-03-31 21:02:33,836 ERROR gateway.platforms.matrix: Matrix: upload failed: Request must specify a Content-Length
2026-03-31 21:04:36,839 WARNING nio.responses: Error validating response: 'content_uri' is a required property

Steps to Reproduce

  1. Enable Matrix and connect (Synapse server), enable STT and TTS.
  2. Send /voice on
  3. Send a voice message in a DM to the agent
  4. Get a text reaction without audio back
  5. Check ~/.hermes/logs/error.log

Expected Behavior

The agent should send back a response with a voice message attached.

Actual Behavior

Only a text message, no errors. Only when digging deeper.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Operating System

Ubuntu 24.04 LTS

Python Version

3.11.15

Hermes Version

Hermes Agent v0.6.0 (2026.3.30)

Relevant Logs / Traceback

2026-03-31 21:02:33,836 ERROR gateway.platforms.matrix: Matrix: upload failed: Request must specify a Content-Length
2026-03-31 21:04:36,839 WARNING nio.responses: Error validating response: 'content_uri' is a required property

Root Cause Analysis (optional)

Synapse requires Content-Length, and without filesize passed to nio, it wasn't being set.

Proposed Fix (optional)

Added filesize=len(data) to the nio.upload() call. gateway/platforms/matrix.py

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions