Problem while creating category

i have a problem while creating channel is specific category. Sometime one of the two category i'm creating (the first one, "travel_category") is not created so when i assign a channel in this category, i have an error. But sometime it works just fine, the cateogry is created and everything works. Here's the code:
const travel_category = await interaction.guild.channels.create({name: "traveler", type: ChannelType.GuildCategory });
const main_category = await interaction.guild.channels.create({name: "main", type: ChannelType.GuildCategory });


sleep(1000)


welcome_channel = await interaction.guild.channels.create({
name: arriving_emoji + "・Welcome",
type: ChannelType.GuildText, // syntax has changed a bit
permissionOverwrites: [{ // same as before
id: interaction.guild.id,
allow: [PermissionFlagsBits.ViewChannel],
deny: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.CreatePrivateThreads, PermissionFlagsBits.CreatePublicThreads]
}]
});
welcome_channel.setParent(travel_category.id)
const travel_category = await interaction.guild.channels.create({name: "traveler", type: ChannelType.GuildCategory });
const main_category = await interaction.guild.channels.create({name: "main", type: ChannelType.GuildCategory });


sleep(1000)


welcome_channel = await interaction.guild.channels.create({
name: arriving_emoji + "・Welcome",
type: ChannelType.GuildText, // syntax has changed a bit
permissionOverwrites: [{ // same as before
id: interaction.guild.id,
allow: [PermissionFlagsBits.ViewChannel],
deny: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.CreatePrivateThreads, PermissionFlagsBits.CreatePublicThreads]
}]
});
welcome_channel.setParent(travel_category.id)
thx
24 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!
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
what you said in 2. is nice, thx but the error (wich is the same problem -> the category doesn't exist) is not as explicit as the error when i set the category in a new line so i'll put the error from MY code but i'll use your 🙂
DiscordAPIError[50035]: Invalid Form Body
parent_id[CHANNEL_PARENT_INVALID]: Category does not exist
at handleErrors (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async GuildChannelManager.edit (C:\Users\samyt\Documents\discord-bot-test\node_modules\discord.js\src\managers\GuildChannelManager.js:315:21) {
requestBody: {
files: undefined,
json: {
name: ':airplane_arriving:・welcome',
type: undefined,
topic: undefined,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
rtc_region: undefined,
video_quality_mode: undefined,
parent_id: '1254477033744896103',
lock_permissions: true,
rate_limit_per_user: undefined,
default_auto_archive_duration: undefined,
permission_overwrites: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_thread_rate_limit_per_user: undefined,
flags: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
parent_id: {
_errors: [
{
code: 'CHANNEL_PARENT_INVALID',
message: 'Category does not exist'
}
]
}
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1254477036051759165'
}
DiscordAPIError[50035]: Invalid Form Body
parent_id[CHANNEL_PARENT_INVALID]: Category does not exist
at handleErrors (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async GuildChannelManager.edit (C:\Users\samyt\Documents\discord-bot-test\node_modules\discord.js\src\managers\GuildChannelManager.js:315:21) {
requestBody: {
files: undefined,
json: {
name: ':airplane_arriving:・welcome',
type: undefined,
topic: undefined,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
rtc_region: undefined,
video_quality_mode: undefined,
parent_id: '1254477033744896103',
lock_permissions: true,
rate_limit_per_user: undefined,
default_auto_archive_duration: undefined,
permission_overwrites: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_thread_rate_limit_per_user: undefined,
flags: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
parent_id: {
_errors: [
{
code: 'CHANNEL_PARENT_INVALID',
message: 'Category does not exist'
}
]
}
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discord.com/api/v10/channels/1254477036051759165'
}
it just say that the category doesn't exist
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
the errore with your code
parent_id[CHANNEL_PARENT_INVALID]: Category does not exist
at handleErrors (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async GuildChannelManager.create (C:\Users\samyt\Documents\discord-bot-test\node_modules\discord.js\src\managers\GuildChannelManager.js:183:18)
at async Object.execute (C:\Users\samyt\Documents\discord-bot-test\commands\setup\auto.js:52:31)
at async Object.execute (C:\Users\samyt\Documents\discord-bot-test\events\interactionCreate.js:38:5) {
requestBody: {
files: undefined,
json: {
name: '🛬・Welcome',
topic: undefined,
type: 0,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
parent_id: '1254476524804112556',
position: undefined,
permission_overwrites: [Array],
rate_limit_per_user: undefined,
rtc_region: undefined,
video_quality_mode: undefined,
default_thread_rate_limit_per_user: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_auto_archive_duration: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { parent_id: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/guilds/1250125877203701841/channels'
}
parent_id[CHANNEL_PARENT_INVALID]: Category does not exist
at handleErrors (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1133:23)
at async SequentialHandler.queueRequest (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:963:14)
at async _REST.request (C:\Users\samyt\Documents\discord-bot-test\node_modules\@discordjs\rest\dist\index.js:1278:22)
at async GuildChannelManager.create (C:\Users\samyt\Documents\discord-bot-test\node_modules\discord.js\src\managers\GuildChannelManager.js:183:18)
at async Object.execute (C:\Users\samyt\Documents\discord-bot-test\commands\setup\auto.js:52:31)
at async Object.execute (C:\Users\samyt\Documents\discord-bot-test\events\interactionCreate.js:38:5) {
requestBody: {
files: undefined,
json: {
name: '🛬・Welcome',
topic: undefined,
type: 0,
nsfw: undefined,
bitrate: undefined,
user_limit: undefined,
parent_id: '1254476524804112556',
position: undefined,
permission_overwrites: [Array],
rate_limit_per_user: undefined,
rtc_region: undefined,
video_quality_mode: undefined,
default_thread_rate_limit_per_user: undefined,
available_tags: undefined,
default_reaction_emoji: undefined,
default_auto_archive_duration: undefined,
default_sort_order: undefined,
default_forum_layout: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: { parent_id: [Object] }
},
code: 50035,
status: 400,
method: 'POST',
url: 'https://discord.com/api/v10/guilds/1250125877203701841/channels'
}
the code
const travel_category = await interaction.guild.channels.create({name: "traveler", type: ChannelType.GuildCategory });
const main_category = await interaction.guild.channels.create({name: "main", type: ChannelType.GuildCategory });


// await sleep(1000)


welcome_channel = await interaction.guild.channels.create({
name: arriving_emoji + "・Welcome",
type: ChannelType.GuildText, // syntax has changed a bit
parent: travel_category,
permissionOverwrites: [{ // same as before
id: interaction.guild.id,
allow: [PermissionFlagsBits.ViewChannel],
deny: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.CreatePrivateThreads, PermissionFlagsBits.CreatePublicThreads]
}]
});
// welcome_channel.setParent(travel_category.id)
const travel_category = await interaction.guild.channels.create({name: "traveler", type: ChannelType.GuildCategory });
const main_category = await interaction.guild.channels.create({name: "main", type: ChannelType.GuildCategory });


// await sleep(1000)


welcome_channel = await interaction.guild.channels.create({
name: arriving_emoji + "・Welcome",
type: ChannelType.GuildText, // syntax has changed a bit
parent: travel_category,
permissionOverwrites: [{ // same as before
id: interaction.guild.id,
allow: [PermissionFlagsBits.ViewChannel],
deny: [PermissionFlagsBits.SendMessages, PermissionFlagsBits.CreatePrivateThreads, PermissionFlagsBits.CreatePublicThreads]
}]
});
// welcome_channel.setParent(travel_category.id)
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
nothing just let welcome_channel;
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
ok but you agree with me that the problem is the creation of the travel_category right?
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
no other bot only the main_category is here
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
i was wrong
Xalri
XalriOP7mo ago
No description
Xalri
XalriOP7mo ago
here's what appear when the bug occure
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
No description
Xalri
XalriOP7mo ago
the category "travel" is simply not created everything come from here i think
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
i don't understand what you want me to send you?
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
travel_category doesn't exist check screen
Unknown User
Unknown User7mo ago
Message Not Public
Sign In & Join Server To View
Xalri
XalriOP7mo ago
here
<ref *2> CategoryChannel {
type: 4,
guild: <ref *1> Guild {
id: '1250125877203701841',
name: 'Bot Test',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *1] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *1] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 0,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 3,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 0,
mfaLevel: 0,
joinedTimestamp: 1718215655295,
defaultMessageNotifications: 0,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 500000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,
preferredLocale: 'en-US',
safetyAlertsChannelId: null,
ownerId: '707698832951214158',
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
guildId: '1250125877203701841',
permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
flags: ChannelFlagsBitField { bitfield: 0 },
id: '1254482583299817655',
name: 'traveler',
rawPosition: 3,
parentId: null
}
<ref *2> CategoryChannel {
type: 4,
guild: <ref *1> Guild {
id: '1250125877203701841',
name: 'Bot Test',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *1] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *1] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 0,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 3,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 0,
mfaLevel: 0,
joinedTimestamp: 1718215655295,
defaultMessageNotifications: 0,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 500000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,
preferredLocale: 'en-US',
safetyAlertsChannelId: null,
ownerId: '707698832951214158',
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
guildId: '1250125877203701841',
permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
flags: ChannelFlagsBitField { bitfield: 0 },
id: '1254482583299817655',
name: 'traveler',
rawPosition: 3,
parentId: null
}
here the same but when it works
<ref *2> CategoryChannel {
type: 4,
guild: <ref *1> Guild {
id: '1250125877203701841',
name: 'Bot Test',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *1] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *1] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 0,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 3,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 0,
mfaLevel: 0,
joinedTimestamp: 1718215655295,
defaultMessageNotifications: 0,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 500000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,
preferredLocale: 'en-US',
safetyAlertsChannelId: null,
ownerId: '707698832951214158',
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
guildId: '1250125877203701841',
permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
flags: ChannelFlagsBitField { bitfield: 0 },
id: '1254482564551282779',
name: 'traveler',
rawPosition: 1,
parentId: null
}
<ref *2> CategoryChannel {
type: 4,
guild: <ref *1> Guild {
id: '1250125877203701841',
name: 'Bot Test',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
scheduledEvents: GuildScheduledEventManager { guild: [Circular *1] },
autoModerationRules: AutoModerationRuleManager { guild: [Circular *1] },
available: true,
shardId: 0,
splash: null,
banner: null,
description: null,
verificationLevel: 0,
vanityURLCode: null,
nsfwLevel: 0,
premiumSubscriptionCount: 0,
discoverySplash: null,
memberCount: 3,
large: false,
premiumProgressBarEnabled: false,
applicationId: null,
afkTimeout: 300,
afkChannelId: null,
systemChannelId: null,
premiumTier: 0,
widgetEnabled: null,
widgetChannelId: null,
explicitContentFilter: 0,
mfaLevel: 0,
joinedTimestamp: 1718215655295,
defaultMessageNotifications: 0,
systemChannelFlags: SystemChannelFlagsBitField { bitfield: 0 },
maximumMembers: 500000,
maximumPresences: null,
maxVideoChannelUsers: 25,
maxStageVideoChannelUsers: 50,
approximateMemberCount: null,
approximatePresenceCount: null,
vanityURLUses: null,
rulesChannelId: null,
publicUpdatesChannelId: null,
preferredLocale: 'en-US',
safetyAlertsChannelId: null,
ownerId: '707698832951214158',
emojis: GuildEmojiManager { guild: [Circular *1] },
stickers: GuildStickerManager { guild: [Circular *1] }
},
guildId: '1250125877203701841',
permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
flags: ChannelFlagsBitField { bitfield: 0 },
id: '1254482564551282779',
name: 'traveler',
rawPosition: 1,
parentId: null
}
i checked, the only differences are the id and the rawPosition (4 last lines) Can someone check the code and help me pls
Want results from more Discord servers?
Add your server