Fix Hermes Agent Profile Routing Error: Discord & Telegram Bots

Fix Hermes Agent Profile Routing Error: Discord & Telegram Bots


If you've ever tried switching profiles in Hermes Agent and got hit with "AttributeError: 'str' object has no attribute 'get'", you're not alone. This Discord and Telegram routing bug happens when bot tokens live inside a profile-specific .env file instead of the root configuration.

Here's what goes wrong — and how to fix it in under five minutes.

The Problem: Bots Bind to the Wrong Profile

Hermes Agent stores Discord and Telegram bot tokens inside a .env file. When that file sits inside a named profile folder — for example profiles/teknoding-content-creator/.env — the bot binds itself to that profile by default, not to the default profile.

Trying to switch profiles with hermes use profile <name> then causes the routing system to break, throwing the AttributeError mentioned above. The bot's configuration becomes misaligned with the running gateway.

The Fix: Three Simple Steps

The solution is straightforward. Move your bot tokens from profile-level storage to root-level storage, clean up leftovers, and restart the service.

Step 1 — Migrate Tokens to Root .env

Locate the .env file inside your profile folder:

c:\Users\YOUR-PC-NAME\AppData\Local\hermes\profiles\teknoding-content-creator\.env

From there, extract these values:

  • DISCORD_BOT_TOKEN
  • TELEGRAM_BOT_TOKEN
  • TELEGRAM_ALLOWED_USERS
  • TELEGRAM_HOME_CHANNEL
  • DISCORD_ALLOWED_USERS
  • DISCORD_HOME_CHANNEL

And move them to the root .env at:

c:\Users\YOUR-PC-NAME\AppData\Local\hermes\.env

This is the main Hermes configuration file — the one the gateway reads first when starting up.

Step 2 — Clean Up Profile-Level Config

After migration, remove the leftover bot configuration from your profile's .env. Keeping duplicate entries causes overlapping gateway processes and routing conflicts.

The goal is a single source of truth — the root .env owns all bot tokens, and profile .env files contain only profile-specific settings (API keys, model preferences, etc.).

Step 3 — Restart the Hermes Gateway

Restart the Hermes Gateway service so it picks up the new environment variables. Once restarted, the gateway boots into the default profile correctly, and the AttributeError disappears.

Your Discord and Telegram bots now route to the intended profile without conflict.

How to Set Up Bots for a New Profile

If you want a dedicated bot for a specific profile — say, a personal assistant called asisten-pribadi — the process is similar but with a critical rule:

Token Isolation

Each profile needs its own unique bot token. Do NOT reuse the same token across profiles. One token = one bot = one gateway. Sharing a token between two profiles causes both gateways to fight over the same connection.

Profile .env Location

For a new profile named asisten-pribadi, create or edit this file:

c:\Users\YOUR-PC-NAME\AppData\Local\hermes\profiles\asisten-pribadi\.env

Add Profile-Specific Bot Config

Inside that file, insert the new bot's tokens:

TELEGRAM_BOT_TOKEN=token_bot_telegram_yang_baru
TELEGRAM_ALLOWED_USERS=123456789
TELEGRAM_HOME_CHANNEL=123456789

DISCORD_BOT_TOKEN=token_bot_discord_yang_baru
DISCORD_ALLOWED_USERS=987654321
DISCORD_HOME_CHANNEL=987654321

Start the Gateway for That Profile

Run the gateway targeting your new profile:

hermes --profile asisten-pribadi gateway start

The bot now binds exclusively to asisten-pribadi, leaving the default profile's bot untouched.

Why This Works

Hermes Agent reads .env files in a priority chain. The root .env is loaded first and sets the baseline configuration. Profile-level .env files overlay profile-specific settings on top. When bot tokens live at the root level, they apply globally — meaning the gateway can route them correctly regardless of which profile is active.

Putting tokens inside a profile folder tells Hermes "this token belongs to this profile only." That's useful for multi-bot setups but breaks routing when you try to switch profiles mid-session.

Key Takeaways

  • Bot tokens belong in the root .env unless you specifically want multi-bot isolation.
  • Never reuse the same bot token across multiple profiles.
  • Always restart the gateway after changing .env files.
  • Profile .env files are for profile-specific settings — not shared bot configuration.

This fix clears the AttributeError and gives you clean, predictable profile routing. If you're running multiple Hermes profiles with their own bots, just remember the one-token-per-profile rule and you'll never hit this issue again.

Teknoding Fathurrahman is a writer and blogger at Teknoding.com. He has written many articles about technology for 5 years. Fathurrahman is driven by a desire to help others understand technology. He makes complex concepts easy to understand, making technology accessible to a wider audience. His articles are engaging narratives that help readers understand the digital world. Fathurrahman is also an active member of the tech community, sharing knowledge and insights with other enthusiasts and experts.

Post a Comment for "Fix Hermes Agent Profile Routing Error: Discord & Telegram Bots"

PIPPIT CAPCUT AI Create Free AI VEO 3.1/SORA 2 Unlimited Videos, Text & Avatars — Nano Banana 🍌

Use CapCut Creator to design videos, images, and avatars with AI — all for free.

Start Creating Now