Common Issues
Port Already In Use / Two Gateways Running
Symptom: Gateway fails to start with a clear error message about port conflicts.Check PID lock and port status
Gateway PID lock: Process 12345 running (127.0.0.1:8765)Port 127.0.0.1:8765: In use
Stop the existing gateway gracefully
SESSION_END event (had_pending_work, was_executing). Use --force to skip the drain. See Gateway Session Continuity.If gateway is stuck, force stop
Telegram Bot Goes Silent After Restart
Symptom: Gateway/health endpoint returns healthy, but Telegram messages aren’t received after a restart or crash.
Cause: Two processes are polling the same Telegram bot token. Telegram delivers messages to only one poller, causing the bot to appear “silent” when the wrong process gets the messages.
Stop all gateway instances
Verify no processes are running
Gateway PID lock: No lock file foundPort 127.0.0.1:8765: Available
Daemon Running But Gateway Unreachable
Symptom:praisonai gateway status shows Daemon service: Running (launchd) but Gateway not reachable at http://127.0.0.1:8765/health.
Check port and PID lock status
Gateway PID lock: Process <pid> runningorNo lock file foundPort 127.0.0.1:8765: In useorAvailable
praisonai gateway stop to stop an existing gateway, or choose a different port.Verify PraisonAI version
Rapidly Growing Log Files
Symptom:~/.praisonai/logs/bot-stderr.log grows to multiple MB per minute.
Daemon Not Installed
Symptom:praisonai gateway status shows Daemon service: Not installed (systemd).
HTTP 500 on Health Endpoint
Symptom:curl http://127.0.0.1:8765/health returns 500 Internal Server Error.
Windows: ‘charmap’ codec error from Telegram bot replies
Symptom: Telegram users receiveError: 'charmap' codec can't encode character '⚠' in position N: character maps to <undefined> instead of the real error message.
Root cause: Windows default console encoding is cp1252, not UTF-8. When agent exceptions contained warning symbols (⚠), emoji, or accented text, the error formatter crashed before the real error could be reported.
Verify your version contains the fix
Upgrade to a fixed version
No workaround needed on supported versions. The previously recommended
PYTHONUTF8=1 / PYTHONIOENCODING=utf-8 workaround is no longer required for the bot reply path (still useful for general console output).Permission Denied Errors
Symptom: Daemon fails to start with permission errors in logs.- macOS
- Linux
- Windows
Clean Reinstall Process
When all else fails, perform a clean reinstall:Reading the hello_error Envelope
When the gateway rejects a connection, it sends a structuredhello_error frame before closing. Each (code, next_step) pair maps to a specific operator action.
code | next_step | Action |
|---|---|---|
rate_limited | wait_then_retry | Wait retry_after_seconds then reconnect; if persistent, raise the rate limiter ceiling |
origin_not_allowed | do_not_retry | Add the client origin to allowed_origins in gateway.yaml |
configuration_error | do_not_retry | External bind without allowed_origins configured; bind to loopback or set the allowlist |
auth_required | reauthenticate | Fetch a token (CLI or pairing flow) and reconnect |
protocol_unsupported | upgrade_client | Update the client SDK to a newer version |
protocol_unsupported | downgrade_client | Server is older than the client; pin the client to an older release or upgrade the server |
agent_not_found | do_not_retry | Fix the agent_id in the hello frame |
ConnectRecoveryStep values.
Authentication Errors
GatewayStartupError: Cannot bind to 0.0.0.0 without an auth token
Symptom: Gateway fails to start when binding to external interfaces without authentication.UIStartupError: Cannot bind to 0.0.0.0 with default admin/admin credentials
Symptom: Chainlit UI fails to start on external interface with default credentials.My gateway logs show gw_****xxxx instead of the full token
This is intentional for security — tokens are fingerprinted in logs to prevent exposure.
Magic-link login works in WebSocket but fails over HTTP (or vice versa)
Symptom: One auth method works but the other fails, even with the same token. Cause (pre-fix): HTTP/magic-link and WebSocket used different secret sources before PR #1744.Upgrade PraisonAI
Upgrade to PraisonAI ≥ v4.6.47 (ships PR #1744). Config token now exports to env, unifying all auth paths.
Restart After Config Change
When you update bot configuration files, restart the daemon using these OS-specific commands (matching the onboard Done panel):- macOS
- Linux
- Windows
Diagnostic Commands
Quick commands for gathering diagnostic information:Platform-Specific Notes
- macOS
- Linux
- Windows
LaunchAgent Path:
~/Library/LaunchAgents/ai.praison.bot.plist
Log Path: ~/.praisonai/logs/bot-stderr.logConfig reload did not apply
Symptom: You editedgateway.yaml or sent SIGHUP, but channels or agents still run the old configuration.
| Check | What to look for |
|---|---|
| Log line | A successful reload logs a summary such as reload applied: agents; restart[telegram] — if absent, the watcher may not have fired or SIGHUP was ignored (Windows has no SIGHUP) |
| Drain window | Channel restarts wait up to gateway.reload_drain_timeout (falls back to drain_timeout) — a slow turn can delay the visible restart |
| Install | pip install "praisonai[gateway]" enables watchdog; without it, mtime polling (about 5 s) still reloads but more slowly |
Multi-Channel Troubleshooting
Common failure modes when using multiple bots on the same platform:| Symptom | Cause | Fix |
|---|---|---|
Token ${X} is used by multiple channels | Two channels reference the same env var in bot.yaml | Give each channel its own env var and create a separate bot in @BotFather |
Same bot token value is used by multiple channels | Two different env vars resolve to the same actual token | Generate a fresh token from @BotFather for the duplicate channel |
Channel '<x>' token '<env>' doesn't follow naming convention | Custom env var name | Rename to PLATFORM_<ROLE>_BOT_TOKEN (e.g. TELEGRAM_CFO_BOT_TOKEN) |
Missing token: <env> | Env var referenced in bot.yaml is unset | Add it to ~/.praisonai/.env |
Channel Supervision Issues
Channel goes silent but /health shows running: true
Symptom: Channel stops receiving messages but/health still reports "running": true.
Cause: Pre-PR-2041 behaviour, or the health: block is missing from gateway.yaml — hung sockets are not detected until an exception is raised.
Fix: Add the proactive health block:
Channel keeps restarting every 5 minutes
Symptom: Channel restarts on a regular interval visible in logs. Cause:stale_after too low for a quiet channel, or interval too aggressive for a slow remote API.
Fix: Raise stale_after to e.g. 600, or lower max_restarts_per_hour so the cap kicks in and surfaces the issue:
Channel Shows state: failed in /health
Symptom: When checkingGET /health, a channel shows "state": "failed" with error details.
Common Causes:
- Telegram Conflict: Multiple bot instances using the same token
- Invalid Credentials: Bot token revoked or incorrect
- Permission Issues: Bot lacks required permissions
Channel Keeps Retrying Forever
Symptom: Hightotal_recoveries count, constant retry attempts visible in logs.
Investigation:
Config Migration
Whenpraisonai doctor --only gateway_config_migration reports Config can be migrated, your YAML uses a legacy shape that loads correctly but can be rewritten to the canonical format.
Understand auto-normalisation
At load time,
GatewayConfigSchema already normalises legacy formats — your bot runs without rewriting the file. Persist the canonical form when you want the on-disk YAML to match what the schema produces.Apply canonical YAML
| Legacy shape | Canonical form |
|---|---|
Top-level platform + token | channels: dict with one entry |
BotOS platforms: dict | channels: dict (same keys) |
allowed_users: "id1,id2" (string) | allowed_users: ["id1", "id2"] (list) |
Environment Variables in Config
Gateway and bot configs support${VAR} substitution in any string value. Resolution order:
- Process environment variables
~/.praisonai/.env(loaded automatically; override path withPRAISONAI_ENV_FILE)
gateway_env_substitution doctor check.
Best Practices
Use praisonai gateway status first
Use praisonai gateway status first
Always run
praisonai gateway status before diving into logs - it shows port, PID, and daemon state in one command.Stop before restart
Stop before restart
Always use
praisonai gateway stop before restarting - this drains active sessions and prevents data loss.Use onboard for fresh installs
Use onboard for fresh installs
When in doubt, run
praisonai onboard - it handles daemon setup, credentials, and port configuration automatically.Check logs for crash loops
Check logs for crash loops
If
bot-stderr.log grows rapidly, you have a crash loop - stop the daemon, upgrade PraisonAI, then restart.Related
Gateway CLI
Gateway command reference
Gateway Server
Gateway configuration and setup

