22 August 2026 · 9 min read

Discord Bot Keeps Going Offline? The Fix Is Proper Hosting — from $4.99/mo

Discord bot keeps going offline? Every cause explained with the exact fix. Sleep timers, crashes, gateway timeouts — and how to stop it with always-on hosting from $4.99/mo.

Your Discord bot keeps going offline. Members complain. Commands stop responding. You restart it manually, it works for a while, then goes offline again.

The permanent fix in most cases is moving to a paid always-on host — getDiscordBot starts at $4.99/mo with a 30-day free trial. But first, let's confirm which of the four causes is hitting you.

Cause 1 — You are running the bot on your own computer

Symptoms: Bot goes offline when you close your laptop, go to sleep, or your internet drops. Works fine while you are at your desk.

Why it happens: The bot process runs on your machine. When your machine sleeps, the process stops. When your internet drops, the Discord WebSocket closes.

Fix: Move the bot to a cloud host that runs 24/7 independently of your computer.

Options (cheapest to most control): - getDiscordBot — paste bot.py, set TOKEN, deploy. $4.99/mo after 1-month free trial. Start free → - Railway — Git-based deployment, ~$5–9/mo - VPS — full Linux server, ~$4–6/mo + management time

Cause 2 — Free tier is sleeping your process

Symptoms: Bot goes offline after 15–30 minutes of no activity. Goes offline at the same time every day or after a fixed period. Comes back online when you manually restart it or send a message.

Why it happens: Free hosting tiers (Replit, old Railway free, Render free web service) pause your process when there is no HTTP traffic. Discord bots do not send or receive HTTP requests — they use WebSockets. So the host's sleep timer fires almost immediately.

Common free tiers that do this:

Platform Free tier behaviour
Replit Deployments Sleeps after inactivity
Render free web service Sleeps after 15 min of no HTTP
Railway Free tier removed in 2023
Glitch Sleeps after 5 min, wakes on HTTP ping

Tricks like "ping your bot with a HTTP request every 5 minutes using cron-job.org" do not work for Discord bots because the bot does not serve HTTP.

Fix: Use a paid always-on host. getDiscordBot never sleeps your bot. The Starter plan is $4.99/mo.

Cause 3 — Unhandled exception crashing the process

Symptoms: Bot goes offline suddenly, not on a timer. Error messages in logs before it goes offline. Comes back if you restart it.

Why it happens: An unhandled Python exception in your event handlers kills the process. Common culprits:

@bot.event
async def on_message(message):
    # This crashes if message.content is None (possible with webhooks)
    if "hello" in message.content:
        await message.channel.send("Hi!")

Fix — add error handling:

@bot.event
async def on_message(message):
    if not message.content:
        return
    if "hello" in message.content.lower():
        await message.channel.send("Hi!")

@bot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.CommandNotFound):
        return
    # Log unexpected errors instead of crashing
    print(f"Error in command {ctx.command}: {error}")

Fix — also add auto-restart on the host:

Even with good error handling, bots can crash. Configure your host to restart automatically:

  • getDiscordBot — auto-restart is built-in. You also get an email with the crash logs.
  • Railway / Render — auto-restart by default
  • VPS with systemd:
[Service]
Restart=always
RestartSec=5

Cause 4 — Discord gateway timeout or disconnect

Symptoms: Bot goes offline for 1–2 minutes then comes back on its own. This happens every few hours or days. No crashes in logs — just a reconnect message.

Why it happens: Discord's gateway sends heartbeats to keep the WebSocket alive. If the bot misses a heartbeat ACK, Discord closes the connection with code 4009 (session timeout). discord.py automatically reconnects in most cases.

Reconnect log output (this is normal):

[discord.gateway] Shard ID None has sent the RESUME payload.
[discord.gateway] Shard ID None has successfully RESUMED session abc123

If reconnects are frequent (more than once/day): This indicates a slow or overloaded host. The bot's Python process is not sending heartbeats fast enough because the server's CPU is saturated or there is high latency to Discord's servers.

Fix: - Upgrade to a host with dedicated CPU allocation - Reduce blocking operations in your event handlers (use await asyncio.sleep() instead of time.sleep()) - Do not run blocking I/O in event handlers — use loop.run_in_executor() for database calls

Cause 5 — Bot is being rate limited by Discord

Symptoms: Bot goes offline for exactly 10 minutes, then comes back. You see HTTP 429 errors in logs.

Why it happens: You are sending too many API requests — messages, reactions, role assignments — too quickly. Discord rate limits you and may close the gateway connection.

Fix:

# Use built-in rate limit handling in discord.py
# It automatically waits when rate limited

# Avoid sending messages in rapid loops
# Wrong:
for member in guild.members:
    await member.send("Hello!")

# Better — add delays:
import asyncio
for member in guild.members:
    await member.send("Hello!")
    await asyncio.sleep(1)  # 1 second between DMs

discord.py 2.x handles most rate limits automatically. If you hit global rate limits, audit your bot for high-frequency API calls.

Cause 6 — Token revoked or invalidated

Symptoms: Bot immediately goes offline after starting. Logs show LoginFailure. Bot never appears in the member list.

Why it happens: Your token was exposed (committed to GitHub, pasted in a chat), and Discord invalidated it. Or you regenerated the token in the Developer Portal without updating it in your host.

Fix:

  1. Go to discord.com/developers/applications
  2. Select your app → Bot tab
  3. Click Reset Token and copy the new token
  4. Update TOKEN in your host's environment variables / Secrets panel
  5. Restart the bot

Prevent it: Always store the token in an environment variable. Never paste it in source code or Discord chats.

How to keep your bot online 24/7 — the permanent fix

The right solution depends on your situation:

Your situation Best fix
Bot runs on your laptop Move to a cloud host
Free tier is sleeping it Upgrade to paid always-on host
Bot crashes on exceptions Add error handling + auto-restart host
Frequent gateway timeouts Better host CPU / reduce blocking code
Token was exposed Rotate token immediately

For most developers, the root cause is #1 or #2. The fix is a paid always-on host that: - Never intentionally pauses your process - Restarts the bot automatically when it crashes - Sends you a crash email so you know what went wrong

getDiscordBot handles all of this at $4.99/mo. No Linux. Paste your bot.py, set your token, deploy.

Start the free 1-month trial — no card required →

Diagnostic checklist

Run through this when your bot goes offline:

  • [ ] Is the bot running on your local machine? → Move to cloud
  • [ ] Are you on a free tier? → Check if it has sleep behaviour
  • [ ] Are there error messages in logs before it went offline? → Fix unhandled exceptions
  • [ ] Does it reconnect by itself after 1–2 min? → Normal gateway reconnect, monitor frequency
  • [ ] Do you see HTTP 429 in logs? → Reduce API call frequency
  • [ ] Does bot.run() fail immediately? → Token issue, reset it

See also: How to host a Discord bot 24/7 → · Always-on hosting explained →

FAQ

Why does my Discord bot keep going offline?

The most common causes: (1) running on your local machine, (2) a free hosting tier sleeping the process, (3) unhandled exceptions crashing your code, or (4) a Discord gateway timeout. The permanent fix is a paid always-on host like getDiscordBot at $4.99/mo.

Why does my Discord bot go offline after a few minutes?

This is almost always a free tier sleeping your process. Render free, Replit, and old Railway free pause processes after 15-30 minutes with no HTTP traffic. Discord bots use WebSockets, not HTTP, so the sleep timer fires immediately. Fix: use a paid always-on host.

How do I keep my Discord bot online 24/7 for free?

There is no reliable free option. Free tiers sleep processes. The cheapest reliable option is getDiscordBot Starter at $4.99/mo with a 30-day free trial — no credit card needed to start.

My Discord bot crashes and goes offline — how do I auto-restart it?

getDiscordBot auto-restarts your bot and emails you the crash logs immediately. On a VPS, configure systemd with Restart=always and set up a mail alert manually.

What is Discord gateway timeout and how do I fix it?

A gateway timeout (code 4009) happens when Discord doesn't receive a heartbeat within the expected window. discord.py handles reconnection automatically for transient timeouts. Persistent timeouts indicate a slow or overloaded server — upgrade your host.

getDiscordBot facts: Python 3.10–3.12 (discord.py, nextcord, py-cord, hikari). Paste bot.py, set TOKEN, stay on the Discord gateway. Starter $4.99/mo (1 bot, 128MB). Pro $9.99/mo (3 bots).

Loading