Error: Expected token to be set for this request, but none was present
As of today, multiple devs have been reporting the error mentioned in the title.
In my case, the bot's code has not been changed for months and the error started occurring randomly earlier today. The token in use is valid.
The error seems to occur when the bot starts interacting with the discord API (e.g.: when calling
channel.setParent).
21 Replies
- What's your exact discord.js
npm list discord.js and node node -v version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅ Marked as resolved by OP
same issue
- Removed bot from the target Guild
- Re-invited bot with admin perms onto same guild
- Bot fails to create a category on said guild
at GuildChannelManager.create
same issue, message sent in the first second work and nothing work after that
manually checked token prior to it being set, its correct

It's seem that the token is unset like 1-2secs after login
So, we're stuck ?
where can u check this
just did targetChannel.send(message) right after login and 5s after in a setInterval
ohh i see
got the same issue, out of the blue, no code changes. Can confirm that token is unset after first call
https://github.com/discordjs/discord.js/blob/43160a6ad75e233fff2be1277e6f2360f918c78d/packages/discord.js/src/structures/ClientUser.js#L64-L77
my hunch is that the api call is not giving back a valid token
no indication that the API response should include the token in the first place https://discord.com/developers/docs/resources/user#user-object so i must be missing something obvious
Seems like you all are right


but everything worked fine hours ago :blobreachReverse:
git blame shows no recent changes to the relevant code

you guys use settimeout or something like that ?
my embed message won't send even after first login
in minimal code, i do not have
i'm wonder if it's setTimeout or something like that
yes
ho, it's working now :d thanks
:pr_open: #10953 in discordjs/discord.js by Jiralite opened <t:1750849756:R> (review required)
fix(ClientUser): Remove token assignment
@Jiralite can we get this for dev too?
we currently utilize the dev version in prod
and i have noticed it
thank you
:rolypoly:
Thanks @Jiralite !
Appreciate the fast follow up
i am grateful for your prompt attention and resolution :rolypoly:
thanks! Have a fantastic day 🙂
commented out those 2 lines earlier today, srry forgot to update regarding it, but it did fix the issue for me
🙇♂️ Awesome!
And thanks everyone else for your input and additional info posted on this issue.
@here
I have same issue on it
unsurprisingly the solution is also the same - update to 14.21.0