Worker keeps crashing
sevgamerpro
FREEOP

25 days ago

It says this:

But i actually put my token in the variables…

WARNING:discord.client:davey is not installed, voice will NOT be supported

[2026-04-27 18:11:13] [INFO ] discord.client: logging in using static token

INFO:discord.client:logging in using static token

File "/app/Bot.py", line 218, in

client.run(DISCORD_TOKEN)

asyncio.run(runner())

return runner.run(main)

return self._loop.run_until_complete(task)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/mise/installs/python/3.12.5/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete

return future.result()

^^^^^^^^^^^^^^^

File "/app/.venv/lib/python3.12/site-packages/discord/client.py", line 922, in runner

await self.start(token, reconnect=reconnect)

File "/app/.venv/lib/python3.12/site-packages/discord/client.py", line 676, in login

TypeError: expected token to be a str, received NoneType instead

WARNING:discord.client:davey is not installed, voice will NOT be supported

File "/app/Bot.py", line 218, in

^^^^^^^^^^^^^^^^

File "/mise/installs/python/3.12.5/lib/python3.12/asyncio/runners.py", line 118, in run

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/mise/installs/python/3.12.5/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete

^^^^^^^^^^^^^^^

await self.start(token, reconnect=reconnect)

Traceback (most recent call last):

client.run(DISCORD_TOKEN)

File "/mise/installs/python/3.12.5/lib/python3.12/asyncio/runners.py", line 194, in run

File "/app/.venv/lib/python3.12/site-packages/discord/client.py", line 922, in runner

File "/app/.venv/lib/python3.12/site-packages/discord/client.py", line 850, in start

File "/app/.venv/lib/python3.12/site-packages/discord/client.py", line 676, in login

$10 Bounty

5 Replies

Status changed to Open Railway 25 days ago


domehane
FREE

25 days ago

Hello sevgamerpro,

your code is reading DISCORD_TOKEN as None meaning python isn't picking up the variable can you share the lines in Bot.py where you read the token? most likely it's a variable name mismatch or missing os.getenv call


domehane

Hello **sevgamerpro,** your code is reading DISCORD\_TOKEN as None meaning python isn't picking up the variable can you share the lines in [Bot.py](http://Bot.py) where you read the token? most likely it's a variable name mismatch or missing os.getenv call

sevgamerpro
FREEOP

25 days ago

python

import os

from dotenv import load_dotenv

load_dotenv()

DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")

**From Bot.py (last line):**

```python

client.run(DISCORD_TOKEN)


sevgamerpro

python import os from dotenv import load\_dotenv load\_dotenv() DISCORD\_TOKEN = os.getenv("DISCORD\_TOKEN") \*\*From `Bot.py` (last line):\*\* \`\`\`python [client.run](http://client.run)(DISCORD\_TOKEN)

domehane
FREE

25 days ago

the problem is load_dotenv() it loads from a .env file locally but on railway there is no .env file so railway injects variables directly into the environment load_dotenv() isn't causing harm but it's not needed either

the real question is does your variable in railway dashboard say exactly DISCORD_TOKEN with no extra spaces or quotes in the value? because the code itself is correct, so it has to be a typo or extra character in the railway variable value


domehane

the problem is load\_dotenv() it loads from a .env file locally but on railway there is no .env file so railway injects variables directly into the environment load\_dotenv() isn't causing harm but it's not needed either the real question is does your variable in railway dashboard say exactly DISCORD\_TOKEN with no extra spaces or quotes in the value? because the code itself is correct, so it has to be a typo or extra character in the railway variable value

sevgamerpro
FREEOP

25 days ago

DISCORD_TOKEN This is what the variable name is


sevgamerpro

DISCORD\_TOKEN This is what the variable name is

domehane
FREE

25 days ago

ok the name is correct can you copy paste the actual value in the variable field? make sure there are no quotes around it like "xxxx" or 'xxxx', just the raw token itself


Welcome!

Sign in to your Railway account to join the conversation.

Loading...