my bot doesn't go online
a45442195-cpu
FREEOP

10 days ago

it crash every time i try to make him online

$10 Bounty

38 Replies

Railway
BOT

10 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway 10 days ago


a45442195-cpu
FREEOP

10 days ago

i did what the diagnosis said and it still dont work


10 days ago

What the diagnose say? Also can you share your Build Logs or Deploy Logs?


Status changed to Awaiting User Response Railway 10 days ago


calibrate-io
PRO

10 days 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.

  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.

  1. 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.

  1. 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.

  1. 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 10 days ago


Status changed to Open 0x5b62656e5d 10 days 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.

a45442195-cpu
FREEOP

10 days 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

10 days 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?

a45442195-cpu
FREEOP

10 days ago

idk then


10 days ago

Okay, since you have run a diagnose, can you share what the diagnose say?


mayori

Okay, since you have run a diagnose, can you share what the diagnose say?

a45442195-cpu
FREEOP

9 days ago

it saying failed now


9 days 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

a45442195-cpu
FREEOP

9 days ago

Screenshot 2026-08-04 21.43.49.png

Attachments


9 days ago

What is your deployment status? Is it Active or Completed or Crashed?


mayori

What is your deployment status? Is it Active or Completed or Crashed?

a45442195-cpu
FREEOP

9 days ago

crashed


9 days ago

Is it a public repo? I'll try deploy it myself and find the problem


mayori

Is it a public repo? I'll try deploy it myself and find the problem

a45442195-cpu
FREEOP

9 days ago

no private


9 days ago

Any error on Build Logs?


mayori

Any error on Build Logs?

a45442195-cpu
FREEOP

9 days ago

yes


9 days ago

Can you paste the logs here? (Or screenshot is fine)


mayori

Can you paste the logs here? (Or screenshot is fine)

a45442195-cpu
FREEOP

9 days ago

Screenshot 2026-08-04 21.57.02.png

Attachments


9 days 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


a45442195-cpu
FREEOP

9 days ago

how to redeploy


a45442195-cpu
FREEOP

9 days ago

i found


a45442195-cpu
FREEOP

9 days ago

crashed


9 days ago

Still nothing else in the Build Logs?


mayori

Still nothing else in the Build Logs?

a45442195-cpu
FREEOP

9 days ago

the same


9 days ago

Try push a blank commit or Deploy the repo as a new service


mayori

Try push a blank commit or Deploy the repo as a new service

a45442195-cpu
FREEOP

9 days ago

commit?


9 days 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

a45442195-cpu
FREEOP

9 days ago

crashed again


h707
PRO

9 days 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.


h707

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.

a45442195-cpu
FREEOP

9 days ago

i have package.json but nothing in it


a45442195-cpu

i have package.json but nothing in it

h707
PRO

9 days ago

You need to initialize your package.json. You can either run npm init -y and npm install discord.js in your local terminal


h707

You need to initialize your package.json. You can either run npm init -y and npm install discord.js in your local terminal

a45442195-cpu
FREEOP

9 days ago

where is local terminal


a45442195-cpu

where is local terminal

h707
PRO

8 days ago

In your Desktop Bash terminal or PowerShell opened inside your project folder


h707

In your Desktop Bash terminal or PowerShell opened inside your project folder

a45442195-cpu
FREEOP

8 days ago

how can i go in bash terminal with linux


8 days ago

The same way you run node index.js or node .

If you're using VSCode, just open your project folder with it and run npm init in the terminal

I'm kinda confused tho, if your bot running well on local, the package.json shouldn't be empty because it need some packages to be installed before it can running


mayori

The same way you run `node index.js` or `node .` If you're using VSCode, just open your project folder with it and run `npm init` in the terminal I'm kinda confused tho, if your bot running well on local, the package.json shouldn't be empty because it need some packages to be installed before it can running

a45442195-cpu
FREEOP

8 days ago

i'm not using vs code


a45442195-cpu

i'm not using vs code

8 days ago

That's an example, you can use any terminal you use for running the bot locally to init the package.json


mayori

That's an example, you can use any terminal you use for running the bot locally to init the package.json

a45442195-cpu
FREEOP

7 days ago

i don't have index.js in my code is that a problem?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...