Skip to content

[Bug]: Gateway extract_media and extract_local_files fail to parse Windows file paths #35270

@kmukul123

Description

@kmukul123

Bug Description

When running Hermes on Windows, if an agent attempts to send a local file or screenshot, the gateway fails to extract the path and upload the attachment.

This occurs in hermes-agent/gateway/platforms/base.py because the regular expressions strictly anchor to POSIX roots (?:~/|/) and forward slashes, completely ignoring Windows drive letters (C:) and backslashes.

Steps to Reproduce

f an agent attempts to send a local file or screenshot, the gateway fails to extract the path and upload the attachment.

Expected Behavior

ff an agent attempts to send a local file or screenshot, the gateway get the right path and upload the attachment.

Actual Behavior

Update the anchor in the regexes for media_pattern and path_re to support Windows drive letters and backslashes, for example changing: (?:/|/) to (?:/|/|[a-zA-Z]:[\/])

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Discord, Telegram

Debug Report

(venv) PS C:\Users\mukul\AppData\Local\hermes> hermes debug share
⚠️  This will upload the following to a public paste service:
  • System info (OS, Python version, Hermes version, provider, which API keys
    are configured — NOT the actual keys)
  • Recent log lines (agent.log, errors.log, gateway.log — may contain
    conversation fragments and file paths)
  • Full agent.log and gateway.log (up to 512 KB each — likely contains
    conversation content, tool outputs, and file paths)

Pastes auto-delete after 6 hours.

Collecting debug report...
Uploading...

Debug report uploaded:
  Report       https://paste.rs/1tu4O
  agent.log    https://paste.rs/l8k56
  gateway.log  https://paste.rs/HOqQh

⏱  Pastes will auto-delete in 6 hours.
To delete now:  hermes debug delete <url>

Operating System

Windows

Python Version

3.11

Hermes Version

v0.15.1

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

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

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverytype/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