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 toolkit7mo 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
Penumbra
Penumbra7mo ago
show your package.json rq
Last' Ysyyn
Last' Ysyyn7mo 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 User7mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' Ysyyn7mo 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 User7mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' Ysyyn7mo ago
root@ubuntu:~/test# node -v v21.1.0 it's djs problem so please try to keep inside it please
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' Ysyyn7mo 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
duck7mo 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' Ysyyn7mo 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 User7mo ago
Message Not Public
Sign In & Join Server To View
Last' Ysyyn
Last' Ysyyn7mo ago
it is sir
duck
duck7mo ago
that's great, but we do not provide support for tos violations entirely
Last' Ysyyn
Last' Ysyyn7mo ago
Okay deleted them fine?
Want results from more Discord servers?
Add your server