Symptom: Gateway fails to start with a clear error message about port conflicts.
Error: Gateway port 8765 is already in use. Another gateway may be running (PID 8864). Stop it: praisonai gateway stop Or use a different port: GATEWAY_PORT=8766 praisonai gateway start Only ONE gateway process should poll each Telegram bot token.
1
Check PID lock and port status
praisonai gateway status
Look for lines like:
Gateway PID lock: Process 12345 running (127.0.0.1:8765)
Port 127.0.0.1:8765: In use
2
Stop the existing gateway gracefully
praisonai gateway stop
This sends SIGTERM and waits for graceful shutdown. The PID lock file will be automatically cleaned up.
3
If gateway is stuck, force stop
praisonai gateway stop --force
This sends SIGKILL directly (SIGTERM on Windows) for immediate termination.
4
If port is used by non-gateway process
# Find what's using the portlsof -i :8765# Linux alternative:netstat -ano | findstr :8765# Either kill that process or use a different portGATEWAY_PORT=8766 praisonai gateway start# Or:praisonai gateway start --port 8766
5
Clean up stale lock file (if needed)
# Check the PID lock filecat ~/.praisonai/gateway-127_0_0_1-8765.pid# Remove stale lock manually (auto-cleaned on next start)rm ~/.praisonai/gateway-127_0_0_1-8765.pid
Stale locks are automatically detected and removed, but you can clean them manually if needed.
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.
1
Stop all gateway instances
praisonai gateway stop --force
This ensures all instances are terminated, even if PID files are corrupted.
2
Verify no processes are running
praisonai gateway status
Should show:
Gateway PID lock: No lock file found
Port 127.0.0.1:8765: Available
3
Start a single gateway instance
praisonai gateway start
Only start one instance to ensure exclusive bot token polling.
4
Test bot responsiveness
Send a message to your Telegram bot. It should respond normally now that only one process is polling the token.
Windows: ‘charmap’ codec error from Telegram bot replies
Symptom: Telegram users receive Error: '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.
If this command runs without error, you have the fix from PR #1754.
2
Upgrade to a fixed version
pip install --upgrade praisonai
Upgrade to PraisonAI version that contains PR #1754 — Gateway and Telegram bot error handlers now sanitize exception text to ASCII-safe form for transport, while preserving full Unicode in logs.
3
Restart the gateway
praisonai gateway install --start
4
Test the fix
Users will now see clean error messages instead of charmap crashes:
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).
# Check systemd user servicesystemctl --user status praisonai-bot# Enable user lingering (allows services to run when not logged in)sudo loginctl enable-linger $(whoami)# Restart servicesystemctl --user daemon-reloadsystemctl --user restart praisonai-bot
# Run as administrator# Check Task Scheduler for PraisonAI taskschtasks /Query /TN PraisonAIGateway# Delete and recreatepraisonai gateway uninstallpraisonai gateway install
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.
1
Upgrade PraisonAI
Upgrade to PraisonAI ≥ v4.6.47 (ships PR #1744). Config token now exports to env, unifying all auth paths.
2
Restart the gateway
praisonai gateway restart
Config token precedence is now enforced on restart.
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
Example Fix:
# Problem: Both channels use the same token# Error: "Token TELEGRAM_BOT_TOKEN is used by multiple channels"# Solution: Create unique tokens per role# 1. Create new bot in @BotFather for CFO role# 2. Add unique environment variableexport TELEGRAM_CFO_BOT_TOKEN="987654321:DEF..."# 3. Update bot.yamlchannels: telegram_cfo: platform: telegram token: ${TELEGRAM_CFO_BOT_TOKEN} # Unique token routes: default: cfo
Validation:
# Check multi-channel configurationpraisonai doctor multi_channel_tokens# ✅ Expected output:# "Multi-channel configuration looks good (N channels)"