Error validating bot token: InvalidArgumentError: invalid Authorization header

Hello sir i'm facing suddenly new djs error in v14 when i try to login into the bot and i'm sure 100% all intents enabled and token working my code
botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

error
js

Error validating bot token: InvalidArgumentError: invalid Authorization header
at processHeaderValue (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:394:11)
at processHeader (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:478:31)
at new Request (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:192:9)
at [http1 build request] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:338:12)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/client.js:363:36)
at Intercept (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/interceptor/redirectInterceptor.js:11:16)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:158:12)
at Client.dispatch (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:179:40)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/pool-base.js:143:28)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:150:29) {
code: 'UND_ERR_INVALID_ARG'
}
js

Error validating bot token: InvalidArgumentError: invalid Authorization header
at processHeaderValue (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:394:11)
at processHeader (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:478:31)
at new Request (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:192:9)
at [http1 build request] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:338:12)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/client.js:363:36)
at Intercept (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/interceptor/redirectInterceptor.js:11:16)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:158:12)
at Client.dispatch (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:179:40)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/pool-base.js:143:28)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:150:29) {
code: 'UND_ERR_INVALID_ARG'
}
Help here pls
29 Replies
d.js toolkit
d.js toolkit10mo ago
- 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
batty
batty10mo ago
show your package.json rq
Last' Ysyyn
Last' YsyynOP10mo ago
{
"name": "nodejs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/voice": "^0.16.1",
"@distube/soundcloud": "^1.3.3",
"@distube/spotify": "^1.5.2",
"@distube/yt-dlp": "^1.1.3",
"@types/node": "^18.0.6",
"axios": "^1.6.7",
"discord-image-generation": "^1.4.25",
"discord.js": "^14.12.1",
"distube": "^4.1.1",
"ejs": "^3.1.9",
"express": "^4.18.2",
"express-session": "^1.17.3",
"fetch": "^1.1.0",
"ffmpeg-static": "^4.4.1",
"fs": "^0.0.1-security",
"fs-extra": "^11.2.0",
"jimp": "^0.22.10",
"jsonfile": "^6.1.0",
"libsodium-wrappers": "^0.7.11",
"moment": "^2.29.4",
"mongoose": "^8.0.2",
"ms": "^2.1.3",
"node-abort-controller": "^3.0.1",
"node-fetch": "^2.6.6",
"opusscript": "^0.0.8",
"passport": "^0.7.0",
"passport-discord": "^0.1.4",
"pm2": "^5.3.0",
"sweetalert2": "^11.6.13",
"yt-search": "^2.10.4",
"ytdl-core": "^4.11.2"
}
}
{
"name": "nodejs",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/voice": "^0.16.1",
"@distube/soundcloud": "^1.3.3",
"@distube/spotify": "^1.5.2",
"@distube/yt-dlp": "^1.1.3",
"@types/node": "^18.0.6",
"axios": "^1.6.7",
"discord-image-generation": "^1.4.25",
"discord.js": "^14.12.1",
"distube": "^4.1.1",
"ejs": "^3.1.9",
"express": "^4.18.2",
"express-session": "^1.17.3",
"fetch": "^1.1.0",
"ffmpeg-static": "^4.4.1",
"fs": "^0.0.1-security",
"fs-extra": "^11.2.0",
"jimp": "^0.22.10",
"jsonfile": "^6.1.0",
"libsodium-wrappers": "^0.7.11",
"moment": "^2.29.4",
"mongoose": "^8.0.2",
"ms": "^2.1.3",
"node-abort-controller": "^3.0.1",
"node-fetch": "^2.6.6",
"opusscript": "^0.0.8",
"passport": "^0.7.0",
"passport-discord": "^0.1.4",
"pm2": "^5.3.0",
"sweetalert2": "^11.6.13",
"yt-search": "^2.10.4",
"ytdl-core": "^4.11.2"
}
}
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
nah it's not using ytb i just import pluugin i do use spotify and deezer only and the code upper on first thread isn't about music, just be on the topic and it's my own freedom to use any pckg that is public right? if you could help thx else someone will
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
root@ubuntu:~/test# node -v v21.1.0 it's djs problem so please try to keep inside it please
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

duck
duck10mo ago
I can't imagine that you have ytdl-core, yt-search, distube, and @distube/yt-dlp just to import them it's your own freedom to use whatever package that's public, but it's also our freedom to not support tos violations
Last' Ysyyn
Last' YsyynOP10mo ago
that's my code ther's not causing the error i want to improve djs by reporting bugs so help please
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
it is sir
duck
duck10mo ago
that's great, but we do not provide support for tos violations entirely
Last' Ysyyn
Last' YsyynOP10mo ago
Okay deleted them fine?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
it's a same package.json of many floders in my freind's vps i'm just running mine okay?
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
HAHAHHA bro it's a bug how lol
botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

botToken = await getToken(1);
console.log(botToken);

// Validate the bot token
clientForValidation = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});


await clientForValidation.login(botToken);
clientForValidation.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});

Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
u kept on tos
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
okay
Unknown User
Unknown User10mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' YsyynOP10mo ago
mr jo i'm sorry @Jô 🌈🦄 i appolgize bruh..
batty
batty10mo ago
show your log (censor the last part of the token) also, can you show the entire code?
Last' Ysyyn
Last' YsyynOP10mo ago
sure
MTIxMjkwMTk5OTg5Nzc0MzM4M***3J-WYWYBSozhPVfF5qstMYYss
Error validating bot token: InvalidArgumentError: invalid Authorization header
at processHeaderValue (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:394:11)
at processHeader (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:478:31)
at new Request (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:192:9)
at [http1 build request] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:338:12)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/client.js:363:36)
at Intercept (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/interceptor/redirectInterceptor.js:11:16)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:158:12)
at Client.dispatch (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:179:40)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/pool-base.js:143:28)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:150:29) {
code: 'UND_ERR_INVALID_ARG'
}
MTIxMjkwMTk5OTg5Nzc0MzM4M***3J-WYWYBSozhPVfF5qstMYYss
Error validating bot token: InvalidArgumentError: invalid Authorization header
at processHeaderValue (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:394:11)
at processHeader (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:478:31)
at new Request (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:192:9)
at [http1 build request] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/core/request.js:338:12)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/client.js:363:36)
at Intercept (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/interceptor/redirectInterceptor.js:11:16)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:158:12)
at Client.dispatch (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:179:40)
at [dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/pool-base.js:143:28)
at [Intercepted Dispatch] (/root/rush/node_modules/@discordjs/rest/node_modules/undici/lib/dispatcher-base.js:150:29) {
code: 'UND_ERR_INVALID_ARG'
}
MTIxMjkwMTk5OTg5Nzc0MzM4M***3J-WYWYBSozhPVfF5qstMYYss @Az
darp
darp10mo ago
invalid token
Last' Ysyyn
Last' YsyynOP10mo ago
Hell it's working and now i'v changed floder and did same thing and it worked Magic
Want results from more Discord servers?
Add your server