Description
The proxy fails to start and enters an infinite crash/restart loop after Telegram began returning negative DC IDs (e.g. -203) in their configuration. The dc_to_pool_name/1 function in mtp_dc_pool.erl raises {invalid_dc_id, DcId} for any unrecognised DC ID, which propagates up through mtp_config and kills the application on startup.
Error
{invalid_dc_id,[{mtp_dc_pool,dc_to_pool_name,[-203],
[{file,"/build/mtproto_proxy/src/mtp_dc_pool.erl"},{line,73}]}
Fix (confirmed working)
Instead of crashing on unknown DC IDs, skip them:
sed -i 's/error({invalid_dc_id, DcId})/begin io:format("Skipping invalid dc_id: ~p~n", [DcId]), skip end/' src/mtp_dc_pool.erl
Full steps to build and deploy the patched image:
git clone https://github.com/seriyps/mtproto_proxy.git
cd mtproto_proxy
sed -i 's/error({invalid_dc_id, DcId})/begin io:format("Skipping invalid dc_id: ~p~n", [DcId]), skip end/' src/mtp_dc_pool.erl
docker build -t mtproto-proxy-patched .
docker run -d \
--name mtproto_proxy \
--restart=always \
--network host \
mtproto-proxy-patched \
-p <port> \
-s <secret> \
-t <tag> \
-a dd
This fix makes the proxy skip any DC IDs it doesn't recognise rather than crashing, and the proxy starts and runs correctly.
Environment
- Image:
seriyps/mtproto-proxy:latest
- Erlang:
erts-10.3.5.19
- Release:
0.1.0
- Observed: February 2026 (following a Telegram infrastructure change)
Description
The proxy fails to start and enters an infinite crash/restart loop after Telegram began returning negative DC IDs (e.g.
-203) in their configuration. Thedc_to_pool_name/1function inmtp_dc_pool.erlraises{invalid_dc_id, DcId}for any unrecognised DC ID, which propagates up throughmtp_configand kills the application on startup.Error
Fix (confirmed working)
Instead of crashing on unknown DC IDs, skip them:
sed -i 's/error({invalid_dc_id, DcId})/begin io:format("Skipping invalid dc_id: ~p~n", [DcId]), skip end/' src/mtp_dc_pool.erlFull steps to build and deploy the patched image:
This fix makes the proxy skip any DC IDs it doesn't recognise rather than crashing, and the proxy starts and runs correctly.
Environment
seriyps/mtproto-proxy:latesterts-10.3.5.190.1.0