Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

495
Views
Discord.JS DiscordAPIError[50035] Invalid Form Body when registering my commands

I am writing a suggest command using a basic command handler from the discord.js guide, whenever I deploy my commands I get the below error. I have tried to edit my embeds to see if that was my issue since I'm fairly new to DiscordJS.


    DiscordAPIError[50035]: Invalid Form Body
guild_id[NUMBER_TYPE_COERCE]: Value "undefined" is not snowflake.
    at SequentialHandler.runRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:753:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (/home/container/node_modules/@discordjs/rest/dist/index.js:565:14)
    at async REST.request (/home/container/node_modules/@discordjs/rest/dist/index.js:999:22) {
  rawError: {
    code: 50035,
    errors: { guild_id: [Object] },
    message: 'Invalid Form Body'
  },
  code: 50035,
  status: 400,
  method: 'PUT',
  url: 'https://discord.com/api/v9/applications/991898175478714409/guilds/undefined/commands',
  requestBody: { files: undefined, json: [ [Object], [Object], [Object] ] }
}

Below is my suggestion command code:


    const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const { suggestChannelID, suggestLogChannelID, suggestManageRoleID } = require('/home/container/config.json');

module.exports = {
  data : new SlashCommandBuilder()
    .setName('suggest')
    .addStringOption(option => option.setName('suggestion').setDescription('The feature you want to suggest').setRequired(true))
    .setDescription('Suggest a feature to be added to our platform(s)'),
  async execute(interaction) {
    var d = new Date();
    const suggestEmbed = new MessageEmbed()
      .setTitle('New Suggestion')
      .setDescription(interaction.options.getString('Suggestion'))
      .setFooter({ text: `Suggested by <@${interaction.member.id}> @ ` + d.toLocaleTimeString() + " GMT" })
    const row = new MessageActionRow()
      .addComponents(
        new MessageButton()
          .setCustomId('upvote')
          .setStyle('SUCCESS')
          .setLabel('Upvote'),
        new MessageButton()
          .setCustomId('downvote')
          .setStyle('DANGER')
          .setLabel('downvote'),
        new MessageButton()
          .setCustomId('accept')
          .setStyle('SUCCESS')
          .setLabel('Accept'),
        new MessageButton()
          .setCustomId('deny')
          .setStyle('DANGER')
          .setLabel('Deny'),
        new MessageButton()
          .setCustomId('remove')
          .setStyle('SECONDARY')
          .setLabel('Remove'),
      )
    interaction.member.guild.channels.cache.get(suggestChannelID).send({ embeds: [suggestEmbed], components: [row] });
    interaction.reply('Suggestion successfully sent!')
  }
}


about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!