2 days ago
it crash every time i try to make him online
31 Replies
2 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 1 day ago
a day ago
i did what the diagnosis said and it still dont work
Status changed to Awaiting User Response Railway • 1 day ago
a day ago
Almost every "my bot crashes and never goes online on Railway" case is one of four things. Open your service → Deploy Logs, scroll to the bottom, and find the last error line — then match it below.
- The token isn't set on Railway (most common)
Error looks like:
Python: discord.errors.LoginFailure: Improper token has been passed.
Node: Error [TokenInvalid]: An invalid token was provided.
Your .env file does not get deployed — it's local only (and usually in .gitignore). So the bot works on your PC and dies on Railway.
Fix: service → Variables → New Variable, add DISCORD_TOKEN (use the exact name your code reads) and paste the token. Or hit Raw Editor and paste your whole .env contents at once. Redeploy.
Also make sure your code actually reads it: os.getenv("DISCORD_TOKEN") / process.env.DISCORD_TOKEN — not a hardcoded string or a .env path.
- Privileged intents aren't enabled
Error looks like:
Python: discord.errors.PrivilegedIntentsRequired
Node: Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted.
This one crashes at login, so the bot never shows as online — matches your description exactly.
Fix: https://discord.com/developers/applications → your app → Bot → scroll to Privileged Gateway Intents → toggle on Message Content Intent (and Server Members Intent if you use member events) → Save. Redeploy. The toggles must match the intents you request in code.
- Your token got auto-revoked
If you ever committed the token to a public GitHub repo, Discord detects it and kills it instantly — you then get the same LoginFailure / TokenInvalid as #1, even though the variable is set.
Fix: Developer Portal → Bot → Reset Token, put the new token in Railway Variables, and make sure .env is in .gitignore.
- It's not crashing — the deploy is being failed by a healthcheck
A Discord bot is a worker: it never listens on a port. If you generated a public domain or set a healthcheck path, Railway waits for an HTTP response that never comes and marks the deploy failed.
Fix: Settings → remove the healthcheck path, and don't generate a domain for the bot service.
If none match: paste the last ~20 lines of your Deploy Logs plus your language (discord.py or discord.js) and I'll pin it down. Scrub the token before pasting.
Status changed to Awaiting Conductor Response Railway • 1 day ago
Status changed to Open 0x5b62656e5d • 1 day ago
calibrate-io
Almost every "my bot crashes and never goes online on Railway" case is one of four things. Open your service → Deploy Logs, scroll to the bottom, and find the last error line — then match it below. 1. The token isn't set on Railway (most common) Error looks like: Python: discord.errors.LoginFailure: Improper token has been passed. Node: Error [TokenInvalid]: An invalid token was provided. Your .env file does not get deployed — it's local only (and usually in .gitignore). So the bot works on your PC and dies on Railway. Fix: service → Variables → New Variable, add DISCORD_TOKEN (use the exact name your code reads) and paste the token. Or hit Raw Editor and paste your whole .env contents at once. Redeploy. Also make sure your code actually reads it: os.getenv("DISCORD_TOKEN") / process.env.DISCORD_TOKEN — not a hardcoded string or a .env path. 2. Privileged intents aren't enabled Error looks like: Python: discord.errors.PrivilegedIntentsRequired Node: Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted. This one crashes at login, so the bot never shows as online — matches your description exactly. Fix: https://discord.com/developers/applications → your app → Bot → scroll to Privileged Gateway Intents → toggle on Message Content Intent (and Server Members Intent if you use member events) → Save. Redeploy. The toggles must match the intents you request in code. 3. Your token got auto-revoked If you ever committed the token to a public GitHub repo, Discord detects it and kills it instantly — you then get the same LoginFailure / TokenInvalid as #1, even though the variable is set. Fix: Developer Portal → Bot → Reset Token, put the new token in Railway Variables, and make sure .env is in .gitignore. 4. It's not crashing — the deploy is being failed by a healthcheck A Discord bot is a worker: it never listens on a port. If you generated a public domain or set a healthcheck path, Railway waits for an HTTP response that never comes and marks the deploy failed. Fix: Settings → remove the healthcheck path, and don't generate a domain for the bot service. If none match: paste the last ~20 lines of your Deploy Logs plus your language (discord.py or discord.js) and I'll pin it down. Scrub the token before pasting.
a day ago
my language is discord.js
2026-08-03 20:01:09.178 UTC [66] LOG: checkpoint complete: wrote 943 buffers (5.8%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.126 s, sync=0.140 s, total=0.290 s; sync files=303, longest=0.038 s, average=0.001 s; distance=4352 kB, estimate=4352 kB; lsn=0/1B9FBA8, redo lsn=0/1B9FBA8
2026-08-03 20:01:09.206 UTC [62] LOG: database system is shut down
done
server stopped
PostgreSQL init process complete; ready for start up.
2026-08-03 20:01:09.327 UTC [13] LOG: starting PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit
2026-08-03 20:01:09.328 UTC [13] LOG: listening on IPv4 address "0.0.0.0", port 5432
2026-08-03 20:01:09.328 UTC [13] LOG: listening on IPv6 address "::", port 5432
2026-08-03 20:01:09.338 UTC [13] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2026-08-03 20:01:09.356 UTC [120] LOG: database system was shut down at 2026-08-03 20:01:09 UTC
2026-08-03 20:01:09.367 UTC [13] LOG: database system is ready to accept connections
2026-08-03 20:06:09.453 UTC [118] LOG: checkpoint starting: time
2026-08-03 20:06:13.873 UTC [118] LOG: checkpoint complete: wrote 43 buffers (0.3%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=4.332 s, sync=0.039 s, total=4.421 s; sync files=12, longest=0.035 s, average=0.004 s; distance=318 kB, estimate=318 kB; lsn=0/1BEF6A0, redo lsn=0/1BEF610
a45442195-cpu
my language is discord.js 2026-08-03 20:01:09.178 UTC [66] LOG: checkpoint complete: wrote 943 buffers (5.8%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=0.126 s, sync=0.140 s, total=0.290 s; sync files=303, longest=0.038 s, average=0.001 s; distance=4352 kB, estimate=4352 kB; lsn=0/1B9FBA8, redo lsn=0/1B9FBA8 2026-08-03 20:01:09.206 UTC [62] LOG: database system is shut down done server stopped PostgreSQL init process complete; ready for start up. 2026-08-03 20:01:09.327 UTC [13] LOG: starting PostgreSQL 18.4 (Debian 18.4-1.pgdg13+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 14.2.0-19) 14.2.0, 64-bit 2026-08-03 20:01:09.328 UTC [13] LOG: listening on IPv4 address "0.0.0.0", port 5432 2026-08-03 20:01:09.328 UTC [13] LOG: listening on IPv6 address "::", port 5432 2026-08-03 20:01:09.338 UTC [13] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2026-08-03 20:01:09.356 UTC [120] LOG: database system was shut down at 2026-08-03 20:01:09 UTC 2026-08-03 20:01:09.367 UTC [13] LOG: database system is ready to accept connections 2026-08-03 20:06:09.453 UTC [118] LOG: checkpoint starting: time 2026-08-03 20:06:13.873 UTC [118] LOG: checkpoint complete: wrote 43 buffers (0.3%), wrote 3 SLRU buffers; 0 WAL file(s) added, 0 removed, 0 recycled; write=4.332 s, sync=0.039 s, total=4.421 s; sync files=12, longest=0.035 s, average=0.004 s; distance=318 kB, estimate=318 kB; lsn=0/1BEF6A0, redo lsn=0/1BEF610
a day ago
This looks like a postgres logs and nothing related to discord.js, whats the problem you ran into? are you unable to connect the bot to the database?
mayori
This looks like a postgres logs and nothing related to discord.js, whats the problem you ran into? are you unable to connect the bot to the database?
a day ago
idk then
mayori
Okay, since you have run a diagnose, can you share what the diagnose say?
15 hours ago
it saying failed now
14 hours ago
Can you open your bot service and copy the Deploy Logs? If you don't know how to, paste a screenshot of your dashboard and I'll guide you how to find it
mayori
Can you open your bot service and copy the Deploy Logs? If you don't know how to, paste a screenshot of your dashboard and I'll guide you how to find it
13 hours ago
Attachments
mayori
What is your deployment status? Is it Active or Completed or Crashed?
13 hours ago
crashed
mayori
Is it a public repo? I'll try deploy it myself and find the problem
13 hours ago
no private
mayori
Any error on Build Logs?
13 hours ago
yes
mayori
Can you paste the logs here? (Or screenshot is fine)
13 hours ago
Attachments
13 hours ago
That doesn't give much info, have you try Redeploy?
If Redeploy didn't fix it, Try Deploy Latest Commit
To do this, you need to Open the Command Palette (Ctrl-K) > select Deploy Latest Commit
If it didn't work, Try deploy it as a new service
13 hours ago
how to redeploy
13 hours ago
i found
13 hours ago
crashed
mayori
Still nothing else in the Build Logs?
13 hours ago
the same
mayori
Try push a blank commit or Deploy the repo as a new service
12 hours ago
commit?
12 hours ago
Yes, if you're deploying a private github repo, you can try push any commit, by adding a blank file or anything
or if you're deploying with the CLI, just run railway up inside of your local project
mayori
Yes, if you're deploying a private github repo, you can try push any commit, by adding a blank file or anything or if you're deploying with the CLI, just run `railway up` inside of your local project
12 hours ago
crashed again
12 hours ago
Ensure the package.json is not missing in the root directory of your project.
Also check that package.json includes a start command under the "scripts" block.
saladin
Ensure the package.json is not missing in the root directory of your project. Also check that package.json includes a start command under the "scripts" block.
2 hours ago
i have package.json but nothing in it
a45442195-cpu
i have package.json but nothing in it
an hour ago
You need to initialize your package.json. You can either run npm init -y and npm install discord.js in your local terminal
