hermes-telegram-fix

Fix Telegram 401 and gateway lock conflicts in Hermes multi-agent deployments.

Updated Sep 1, 2021
One-click install
npx skills add https://github.com/unclehowell/unclehowell --skill hermes-telegram-fix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hermes-telegram-fix
Source: https://github.com/unclehowell/unclehowell/tree/main/skills/devops/hermes-telegram-fix
Command: npx skills add https://github.com/unclehowell/unclehowell --skill hermes-telegram-fix

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a clear, actionable procedure to stop Telegram 401 errors and "Another local Hermes gateway is already using this Telegram bot token" lock conflicts that occur when multiple Hermes gateway or command-agent processes on one host attempt to poll the same Telegram bot token.

Core Features & Use Cases

  • Identify root causes: Explains common causes including systemd units hardcoding TELEGRAM_BOT_TOKEN, shared gateway.env files, multiple concurrent gateway processes, stale lock files, and stale gateway_state.json.
  • Safe remediation steps: Shows how to remove TELEGRAM_BOT_TOKEN from systemd, disable Telegram in the default agent config, kill duplicate gateway processes, and clean stale lock and state files.
  • Verification guidance: Describes how to verify processes and detect stale locks so Telegram polling is owned by the intended agent.
  • Use Case: Recover a multi-agent Hermes deployment on a single server after accidental gateway takeover or after gateway crashes leave stale locks.

Quick Start

Run the hermes-telegram-fix procedure to remove TELEGRAM_BOT_TOKEN from systemd, disable Telegram in the default agent config, terminate duplicate gateway processes, delete stale gateway lock files and gateway_state.json, and then restart gateway and cmd-agent services to restore correct token ownership.

Frequently Asked Questions about hermes-telegram-fix

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix Telegram 401 errors in Hermes multi-agent deployments?

Telegram 401 errors in Hermes deployments are fixed by removing hardcoded TELEGRAM_BOT_TOKEN from systemd units, killing duplicate gateway processes, and deleting stale lock files. This restores exclusive token polling ownership to the intended agent.

Why does my Hermes gateway say another local gateway is already using the Telegram bot token?

The lock conflict occurs when multiple Hermes gateway or command-agent processes on one host attempt to poll the same Telegram bot token. Causes include shared gateway.env files, concurrent processes, and stale gateway_state.json files left after crashes.

How do I clean up stale Hermes gateway lock files and gateway_state.json?

To clean up stale Hermes locks, identify and terminate duplicate gateway processes, then manually remove stale lock files and gateway_state.json. Restarting the gateway and cmd-agent services restores correct token ownership.

Can I disable Telegram in the default Hermes agent config to prevent bot token conflicts?

Yes, disabling Telegram in the default agent config prevents bot token conflicts. Combined with removing the TELEGRAM_BOT_TOKEN from systemd environment variables, this ensures only the intended gateway process polls the Telegram bot.

What steps are needed to restore exclusive Telegram bot token ownership after a Hermes gateway crash?

Restoring exclusive Telegram bot token ownership requires removing hardcoded tokens from systemd, disabling Telegram in default configs, killing duplicate processes, deleting stale lock files, and restarting gateway and cmd-agent services.