Fixing a bot that keeps going offline after a few minutes on free hosting — the real cause (no HTTP port) and a one-line python fix.

Why Does My Bot Go Offline After a Few Minutes on Free Hosting?

You deploy a Telegram or Discord bot to a free host, it works for a bit, then it just... stops. No crash log, no obvious error — it just goes quiet, and sometimes comes back after you push a new commit or manually restart the service. If this sounds familiar, you're not dealing with a bug in your bot's code. This is almost always one specific, well-understood cause, and it has a one-line fix.

Table of Contents

The Symptom