title: DiscordAPIError: Invalid Form Body when trying to create multiple commands
body: <p>I'm learning to create a discord bot and i faced an error that i can't figure out how to solve... I was trying to create multiple commands with objects in array. When i was doing just one object without using the array it was warking but as soon as i created the array and inserted 2 commands it throw me the following error:</p>
  <pre><code>I:\botDiscord\secondo-bot\node_modules\discord.js\src\rest\RequestHandler.js:350
        throw new DiscordAPIError(data, res.status, request);
              ^
  
  DiscordAPIError: Invalid Form Body
  name: Command name is invalid
      at RequestHandler.execute (I:\botDiscord\secondo-bot\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async RequestHandler.push (I:\botDiscord\secondo-bot\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
      at async GuildApplicationCommandManager.set (I:\botDiscord\secondo-bot\node_modules\discord.js\src\managers\ApplicationCommandManager.js:146:18)
      at async Client.&lt;anonymous&gt; (I:\botDiscord\secondo-bot\index.js:39:4) {
    method: 'put',
    path: '/applications/970439955660812309/guilds/968170513774039201/commands',
    code: 50035,
    httpStatus: 400,
    requestData: {
      json: [
        {
          name: 'Ping',
          description: 'risponde pong',
          type: undefined,
          options: undefined,
          default_permission: undefined
        },
        {
          name: 'pong',
          description: 'risponde ping',
          type: undefined,
          options: undefined,
          default_permission: undefined
        }
      ],
      files: []
    }
  }
  
  Node.js v18.0.0
  </code></pre>
  <p>And here is the code that i used for receive this error... please help me... is more than 6 hour that I'm trying to understand where is my mistake.</p>
  <p>Obviously where I put 'My_Discord_Id' and 'My_Bot_id' i used to insert the relevants ids</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { Client, Intents } = require("discord.js");
  
  const client = new Client({
    intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
  });
  
  client.once("ready", () =&gt; {
    console.log("Bot Online");
  });
  
  client.on("interactionCreate", async(interaction) =&gt; {
    if (!interaction.isCommand()) return;
  
    if (interaction.commandName === "ping") {
      await interaction.reply({
        content: "pong",
        ephimeral: true
      });
    } else if (interaction.commandName === "pong") {
      await interaction.editReply({
        content: "ping",
        ephemeral: true,
      });
    }
  });
  
  client.on("messageCreate", async(message) =&gt; {
    if (!client.application ? .owner) await client.application ? .fetch();
  
    if (message.author.id === client.application ? .owner.id) {
      if (message.content.toLowerCase() == "!reg1") {
        const data = [{
            name: "Ping",
            description: "risponde pong",
          },
          {
            name: "pong",
            description: "risponde ping",
          },
        ];
        await client.guilds.cache
          .get("My_Discord_Id") ?
          .commands.set(data);
      }
    }
  });
  
  client.login("My_Bot_Id");</code></pre>
  </div>
  </div>
  </p>