(guild create channel) ---> TypeError [InvalidType]: Supplied parameter is not a User nor a Role.

{
name: 'amal-accept-application',
type: 0,
parent: '1129515735014719600',
permissionOverwrites: [
{ id: '1098722587896463400', deny: [Array] },
{ id: '907818163192868914', allow: [Array] }
]
}
{
name: 'amal-accept-application',
type: 0,
parent: '1129515735014719600',
permissionOverwrites: [
{ id: '1098722587896463400', deny: [Array] },
{ id: '907818163192868914', allow: [Array] }
]
}
Full error:
TypeError [InvalidType]: Supplied parameter is not a User nor a Role.
at Function.resolve (/workspace/node_modules/discord.js/src/structures/PermissionOverwrites.js:184:28)
at /workspace/node_modules/discord.js/src/managers/GuildChannelManager.js:168:81
at Array.map (<anonymous>)
at GuildChannelManager.create (/workspace/node_modules/discord.js/src/managers/GuildChannelManager.js:168:51)
at createChannel (/workspace/helpers.ts:69:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.<anonymous> (/workspace/index.ts:269:23) {
code: 'InvalidType'
}
TypeError [InvalidType]: Supplied parameter is not a User nor a Role.
at Function.resolve (/workspace/node_modules/discord.js/src/structures/PermissionOverwrites.js:184:28)
at /workspace/node_modules/discord.js/src/managers/GuildChannelManager.js:168:81
at Array.map (<anonymous>)
at GuildChannelManager.create (/workspace/node_modules/discord.js/src/managers/GuildChannelManager.js:168:51)
at createChannel (/workspace/helpers.ts:69:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Client.<anonymous> (/workspace/index.ts:269:23) {
code: 'InvalidType'
}
No description
2 Replies
d.js toolkit
d.js toolkit13mo 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
charlie
charlieOP13mo ago
could it be a permission issue i am admin in the server and it works for me, but the other users are not admins the guild (server) is old, not sure exactly but many months okay managed to fix this, very odd. i added this before:
let user;
try {
user = await client.users.fetch(user_id);
} catch (error) {
console.error("Error fetching user:", error);
return false;
}
if (!user) {
return false;
}
let user;
try {
user = await client.users.fetch(user_id);
} catch (error) {
console.error("Error fetching user:", error);
return false;
}
if (!user) {
return false;
}
and used user.id in the permissions overwrite and it worked
Want results from more Discord servers?
Add your server