Bug Description
When sending a MEDIA file that does not exist, _send_local_file() sends an error message (file not found: /path) to the main room instead of the intended thread. This happens because the error message bypasses thread routing — metadata (containing thread_id) is not properly handled.
Steps to Reproduce
- Send a message with
MEDIA:/nonexistent/path/file.png in a Matrix thread
- The file does not exist
- Error message
(file not found: /path) appears in the main room, not the thread
Expected Behavior
Current code (gateway/platforms/matrix.py, ~line 1359)
if not p.exists():
return await self.send(
room_id, f"{caption or ''}\n(file not found: {file_path})", reply_to,
metadata=metadata
)
Actual Behavior
Proposed fix
Silently skip the missing file and log a warning:
if not p.exists():
logger.warning("Matrix: MEDIA file not found, skipping: %s", file_path)
return SendResult(success=False, error=f"file not found: {file_path}")
This avoids sending confusing error messages to the wrong location.
Environment
- Platform: Matrix
- Use case: Sending generated files that may fail to create
### Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp)
### Messaging Platform (if gateway-related)
_No response_
### Debug Report
```shell
-
Operating System
Ubuntu 24.04
Python Version
No response
Hermes Version
No response
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
No response
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?
Bug Description
When sending a MEDIA file that does not exist,
_send_local_file()sends an error message(file not found: /path)to the main room instead of the intended thread. This happens because the error message bypasses thread routing —metadata(containingthread_id) is not properly handled.Steps to Reproduce
MEDIA:/nonexistent/path/file.pngin a Matrix thread(file not found: /path)appears in the main room, not the threadExpected Behavior
Current code (gateway/platforms/matrix.py, ~line 1359)
Actual Behavior
Proposed fix
Silently skip the missing file and log a warning:
This avoids sending confusing error messages to the wrong location.
Environment
Operating System
Ubuntu 24.04
Python Version
No response
Hermes Version
No response
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
No response
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?