[ERR_INVALID_ARG_TYPE]

[ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number(0)
[ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number(0)
The code:
const { AudioPlayerStatus,
createAudioPlayer,
NoSubscriberBehavior,
createAudioResource,
joinVoiceChannel,
StreamType,
createSilence,
} = require("@discordjs/voice");
// ...
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
});
const audioPlayer = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});
connection.subscribe(audioPlayer);
const audioData = [];
audioPlayer.on('data', (chunk) => {
audioData.push(chunk);
});
audioPlayer.on('error', (error) => {
console.error('Error collecting audio data:', error);
connection.destroy();
});
const { AudioPlayerStatus,
createAudioPlayer,
NoSubscriberBehavior,
createAudioResource,
joinVoiceChannel,
StreamType,
createSilence,
} = require("@discordjs/voice");
// ...
const connection = joinVoiceChannel({
channelId: voiceChannel.id,
guildId: voiceChannel.guild.id,
adapterCreator: voiceChannel.guild.voiceAdapterCreator,
});
const audioPlayer = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause,
},
});
connection.subscribe(audioPlayer);
const audioData = [];
audioPlayer.on('data', (chunk) => {
audioData.push(chunk);
});
audioPlayer.on('error', (error) => {
console.error('Error collecting audio data:', error);
connection.destroy();
});
Errors as soon as i run the command to create audioPlayer. Discord.JS Version: [email protected] Full Error Stack: https://codeboard.tech/bin/SgGQZj40
Full Error Stack/CodeBoard
This is the full error stack of [ERR_INVALID_ARG_TYPE]
1 Reply
Marban
MarbanOP17mo ago
I'm sorry I was the culprit here. I tried to attach an audio receiver to an audio player. Fixed it by reading the docs. Thanks.
Want results from more Discord servers?
Add your server