hermes - 💡(How to fix) Fix [Bug]: Podman user ID matching

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

┌─────────────────────────────────────────────────────────┐ │ ⚕ Hermes Gateway Starting... │ ├─────────────────────────────────────────────────────────┤ │ Messaging platforms + cron scheduler │ │ Press Ctrl+C to stop │ └─────────────────────────────────────────────────────────┘

ERROR gateway.platforms.slack: [Slack] Connection failed: [Errno 13] Permission denied: '/opt/hermes/.local' Traceback (most recent call last): File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir os.mkdir(self, mode) ~~~~~~~~^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes/gateway-locks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir os.mkdir(self, mode) ~~~~~~~~^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir os.mkdir(self, mode) ~~~~~~~~^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/hermes/gateway/platforms/slack.py", line 527, in connect if not self._acquire_platform_lock('slack-app-token', app_token, 'Slack app token'): ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/hermes/gateway/platforms/base.py", line 1475, in _acquire_platform_lock acquired, existing = acquire_scoped_lock( ~~~~~~~~~~~~~~~~~~~^ scope, identity, metadata={'platform': self.platform.value} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/opt/hermes/gateway/status.py", line 556, in acquire_scoped_lock lock_path.parent.mkdir(parents=True, exist_ok=True) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir self.parent.mkdir(parents=True, exist_ok=True) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir self.parent.mkdir(parents=True, exist_ok=True) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir self.parent.mkdir(parents=True, exist_ok=True) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir os.mkdir(self, mode) ~~~~~~~~^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied: '/opt/hermes/.local' WARNING gateway.run: ✗ slack failed to connect ERROR gateway.run: Gateway failed to connect any configured messaging platform: slack: failed to connect

Root Cause

Root Cause Analysis (optional)

Code Example

...
-v ~/.hermes:/opt/data \
--userns=keep-id \
...

---

...
-v ~/.hermes:/opt/data \
--userns=keep-id \
-e WANTED_UID=$(id -u) \
-e WANTED_GID=$(id -g) \
...

---

podman run -it --rm \
  --userns=keep-id \
  --user $(id -u):$(id -g) \
  -v ~/.hermes:/opt/data \
  -e WANTED_UID=$(id -u) \
  -e WANTED_GID=$(id -g) \
  docker.io/nousresearch/hermes-agent \
  setup

---

podman run -d \
  --name hermes \
  --restart unless-stopped \
  --userns=keep-id \
  --user $(id -u):$(id -g) \
  -v ~/.hermes:/opt/data \
  -e WANTED_UID=$(id -u) \
  -e WANTED_GID=$(id -g) \
  -p 8642:8642 \
  docker.io/nousresearch/hermes-agent gateway run

---

┌─────────────────────────────────────────────────────────┐
│           ⚕ Hermes Gateway Starting...├─────────────────────────────────────────────────────────┤
Messaging platforms + cron scheduler                    │
Press Ctrl+C to stop                                   │
└─────────────────────────────────────────────────────────┘

ERROR gateway.platforms.slack: [Slack] Connection failed: [Errno 13] Permission denied: '/opt/hermes/.local'
Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes/gateway-locks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hermes/gateway/platforms/slack.py", line 527, in connect
    if not self._acquire_platform_lock('slack-app-token', app_token, 'Slack app token'):
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hermes/gateway/platforms/base.py", line 1475, in _acquire_platform_lock
    acquired, existing = acquire_scoped_lock(
                         ~~~~~~~~~~~~~~~~~~~^
        scope, identity, metadata={'platform': self.platform.value}
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/hermes/gateway/status.py", line 556, in acquire_scoped_lock
    lock_path.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/opt/hermes/.local'
WARNING gateway.run: ✗ slack failed to connect
ERROR gateway.run: Gateway failed to connect any configured messaging platform: slack: failed to connect

---
RAW_BUFFERClick to expand / collapse

Bug Description

I'm running Hermes agent in a rootless podman container inside an LXD container. I noticed that I only pass in these arguments then Hermes overwrites the user and group id of the volume with one from the subid range.

Test Alpine container running in the LXD with just --userns=keep-id and it runs fine using the current user. It's not critical but it does add friction when trying to maintain configurations, etc.

...
-v ~/.hermes:/opt/data \
--userns=keep-id \
...

or

...
-v ~/.hermes:/opt/data \
--userns=keep-id \
-e WANTED_UID=$(id -u) \
-e WANTED_GID=$(id -g) \
...

Trying to force the user ID explicitly allows set up to run and the CLI works. But trying to run the gateway subsequently fails with a permission issue:

Setup: OK

Command:

podman run -it --rm \
  --userns=keep-id \
  --user $(id -u):$(id -g) \
  -v ~/.hermes:/opt/data \
  -e WANTED_UID=$(id -u) \
  -e WANTED_GID=$(id -g) \
  docker.io/nousresearch/hermes-agent \
  setup

Gateway: Fails

Command:

podman run -d \
  --name hermes \
  --restart unless-stopped \
  --userns=keep-id \
  --user $(id -u):$(id -g) \
  -v ~/.hermes:/opt/data \
  -e WANTED_UID=$(id -u) \
  -e WANTED_GID=$(id -g) \
  -p 8642:8642 \
  docker.io/nousresearch/hermes-agent gateway run

Output: ERROR gateway.platforms.slack: [Slack] Connection failed: [Errno 13] Permission denied: '/opt/hermes/.local' Traceback (most recent call last): File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir os.mkdir(self, mode) ~~~~~~~~^^^^^^^^^^^^

Steps to Reproduce

  1. Create an Alpine LXD container
  2. Configure to run podman per Alpine wiki
  3. Create ~/.hermes directory
  4. Run set up as describe above
  5. Run the gateway as described above

Expected Behavior

Hermes agent should run with current user's id and group.

Actual Behavior

Hermes agent ignores --userns=keep-id and -e WANTED_UID=$(id -g) -e WANTED_GID=$(id -g)

and overwrites with sub user and group ID. Or gateway errors out if I pass in --user $(id -u):$(id -g).

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

Slack

Debug Report

┌─────────────────────────────────────────────────────────┐
│           ⚕ Hermes Gateway Starting...                 │
├─────────────────────────────────────────────────────────┤
│  Messaging platforms + cron scheduler                    │
│  Press Ctrl+C to stop                                   │
└─────────────────────────────────────────────────────────┘

ERROR gateway.platforms.slack: [Slack] Connection failed: [Errno 13] Permission denied: '/opt/hermes/.local'
Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes/gateway-locks'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state/hermes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/hermes/.local/state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/hermes/gateway/platforms/slack.py", line 527, in connect
    if not self._acquire_platform_lock('slack-app-token', app_token, 'Slack app token'):
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hermes/gateway/platforms/base.py", line 1475, in _acquire_platform_lock
    acquired, existing = acquire_scoped_lock(
                         ~~~~~~~~~~~~~~~~~~~^
        scope, identity, metadata={'platform': self.platform.value}
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/opt/hermes/gateway/status.py", line 556, in acquire_scoped_lock
    lock_path.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 728, in mkdir
    self.parent.mkdir(parents=True, exist_ok=True)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/pathlib/_local.py", line 724, in mkdir
    os.mkdir(self, mode)
    ~~~~~~~~^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/opt/hermes/.local'
WARNING gateway.run: ✗ slack failed to connect
ERROR gateway.run: Gateway failed to connect any configured messaging platform: slack: failed to connect

Operating System

Alpine 3.23 Cloud

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?

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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING