An app going offline is a symptom with a handful of distinct causes, and they are easy to tell apart once you know what to look for. Work down this list in order. It is roughly the order of how often each one is the answer.
The process stopped
The most common cause, and the least interesting. Your app crashed, or the machine running it went to sleep, or the terminal you started it in was closed. If the app is running on your own computer, this is almost always it.
The tell is that it goes offline at the same time you stop using your machine, and comes back when you start it again.
An unhandled rejection killed it
Node exits on an unhandled promise rejection. One API call that fails without a catch, and the whole process is gone. No error in Discord, nothing in the channel, just an absence.
Add that and the next crash tells you what it was instead of vanishing. It is not a fix, you still want the catch, but it turns an invisible failure into a readable one.
It ran out of memory
An app that runs fine for hours then dies under load is usually hitting a memory ceiling. Caching every message, holding large guild collections, or launching a browser will do it.
The signature is an app that dies during activity rather than during quiet, and comes straight back on restart. If your host reports memory, watch it climb toward the cap before each death.
The token was rotated or revoked
If you reset the token in the Developer Portal and did not update it where the app runs, the app will not reconnect after its next restart. It stays online until then, which is what makes this one confusing: the break and the cause can be hours apart.
The log line is unambiguous: an authentication failure at startup, right at the top.
It is rate limited or the gateway dropped it
Discord will close connections, and every serious library reconnects on its own with backoff. If yours does not seem to, check you are not catching and swallowing the disconnect event, and that you are not creating a new client on every reconnect.
Sustained rate limiting looks different: the app stays online but stops responding. That is not an uptime problem, it is a request-volume problem.
The host put it to sleep
Free tiers suspend idle processes. Your app is idle by nature, it waits for events, so it looks idle to a platform measuring inbound HTTP traffic. It goes to sleep and the gateway connection dies with it.
Telling them apart quickly
| SYMPTOM | MOST LIKELY |
|---|---|
| Dies when you close your laptop | It is running on your laptop |
| Dies after a fixed period of quiet | Host sleep policy |
| Dies under load, returns on restart | Out of memory |
| Never connects after a restart | Token or intents |
| Online but ignores commands | Rate limits, or the handler threw |
| Dies at random, no pattern | Unhandled rejection |
What to do about it
Read the logs first. Almost every cause above announces itself in the first few lines after a restart, and guessing is slower than looking.
Then make restarts automatic. Crashes are normal in a long-running process; what separates a reliable app from a flaky one is that the reliable one comes back without you. On Spocket that is the default, and an app that crash-loops stops being retried and tells you instead of hiding behind a green dot.