This guide covers common problems you may encounter when running the Telegram Bot API Docker container and how to resolve them.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ragnarok22/telegram-bot-api-docker/llms.txt
Use this file to discover all available pages before exploring further.
Common Issues
Missing credentials error
Missing credentials error
Error message:Solution:
- Ensure
TELEGRAM_API_IDandTELEGRAM_API_HASHare present in your.envfile - Get your credentials from https://my.telegram.org
- Verify the
.envfile is correctly loaded with--env-file .envflag
.env file:Permission issues with host volume
Permission issues with host volume
Symptoms:Note: The container runs as non-root user
- Container fails to write logs
- Cannot create bot data files
- Permission denied errors in logs
- Create the
./datadirectory before first run - Ensure the directory is writable by the container user (UID 1000)
- Check directory permissions:
botapi:botapi for security.Port conflicts
Port conflicts
Symptoms:
- Container fails to start
- Error: “Address already in use”
- Cannot bind to port 8081 or 8082
- Change
TELEGRAM_HTTP_PORTand/orTELEGRAM_HTTP_STAT_PORTin your.envfile - Map matching host ports when running the container
API call failures
API call failures
Symptoms:
- Bot methods return errors
- Timeout when calling bot endpoints
- 401 Unauthorized responses
- Check container logs:
docker logs <container-name> - Review the log file at
/data/logs/telegram-bot-api.log - Verify your bot token is valid
- Ensure the container is healthy:
docker ps
Container not starting
Container not starting
Diagnosis steps:
-
Check container status:
-
View container logs:
-
Inspect container details:
- Missing required environment variables
- Port conflicts
- Volume mount permission issues
- Invalid configuration in
TELEGRAM_EXTRA_ARGS
Health check failures
Health check failures
Health check command:Check health status:Common issues:
- HTTP port misconfigured (verify
TELEGRAM_HTTP_PORTmatches exposed port) - Container network issues
- Server failed to start properly
Network connectivity issues
Network connectivity issues
Symptoms:
- Cannot reach Telegram servers
- Bot updates not received
- Webhook delivery failures
-
Verify container network:
-
Test DNS resolution:
- Check firewall rules and ensure outbound connections are allowed
- For custom networks, ensure proper DNS configuration
Log Files
The default log file location is/data/logs/telegram-bot-api.log inside the container.
Accessing logs
View logs from mounted volume:TELEGRAM_LOG_FILE environment variable:
Increase log verbosity
UseTELEGRAM_EXTRA_ARGS to set verbosity level:
0- Fatal errors only1- Errors2- Warnings3- Info (default)4- Debug5- Verbose debug
Migration Issues
Switching from api.telegram.org
Migration steps:-
Call
logOuton the official API: -
Point your bot client to your local server:
-
If using
--localmode, ensure your bot handles absolute file paths ingetFileresponses
Moving between local servers
Safe migration process:- Call logOut on the old server
- Optionally call deleteWebhook, then close to reduce update loss
- Move the bot subdirectory (named by bot user ID) from old to new server:
Getting Help
If you encounter issues not covered here:- Check existing issues: GitHub Issues
- Review upstream documentation: Issues with the Telegram Bot API server itself should be reported to tdlib/telegram-bot-api
- Join the community: @BotTalk on Telegram