I need help with something in logs

Even though there are no errors in my code, the code isnt working.

Though, I do have something, when I looked in the Log, I saw this:

(node:30902) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided.

2:22 PM

at WebSocketManager.connect (/rbd/pnpm-volume/6f0ae998-aadc-48c7-8984-5f5fd361e6a7/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/client/websocket/WebSocketManager.js:133:26)

2:22 PM

at Client.login (/rbd/pnpm-volume/6f0ae998-aadc-48c7-8984-5f5fd361e6a7/node_modules/.registry.npmjs.org/discord.js/12.5.3/node_modules/discord.js/src/client/Client.js:223:21)

2:22 PM

at process.runNextTicks [as _tickCallback] (internal/process/task_queues.js:54:5)

2:22 PM

at Function.Module.runMain (internal/modules/cjs/loader.js:828:11)

2:22 PM

at internal/main/run_main_module.js:17:11

2:22 PM

(node:30902) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

2:22 PM

(node:30902) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If anybody knew the answer, it would be really helpful.

Cheers! - Arto!

Hi Artorol, welcome to the forum!

Looks like a Discord bot. Have you checked that the token you are using is still valid?


yep its the same.

“the same” doesn’t necessarily mean complete, or valid. It is possible that a valid token value exists but it isn’t getting assigned properly. I could have a leading space, etc.

My suggestion would be to create another bot (use the same token) that does nothing but connect. If the simplest code possible doesn’t work it tells you something, if it does that tells you something also.


Could you regenerate your token and place the regenerated one in your project?

1 Like

might try that

Also check that whatever code you’re using to bring your token in, isn’t adding spaces around it or changing it somehow.

If you can show us your code without sharing your discord token, I’d like to see it to check for problems :slight_smile: …since the error does seem to say it’s a problem with your token

thanks, it worked