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

144
Views
Getting 'DiscordAPIError: Invalid Form Body' when trying to send an embed

When someone tries to show the queue of a really big playlist, the bot crashes with the error: DiscordAPIError: Invalid Form Body data.embeds[0].description: Must be 4096 or fewer in length.

This is the code that shows the queue:

case "queue" : 
    return interaction.reply({embeds: [new MessageEmbed()
        .setColor("PURPLE")
        .setDescription(`${queue.songs.map(
            (song, id) => `\n**${id + 1}**. ${song.name} - \`${song.formattedDuration}\`` )}`
    )]});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Its exactly what the error says. Discord embed limitations: (https://discord.com/developers/docs/resources/channel#embed-limits)

Ur embed description must have less then 4096 characters. You can just use a function to trim the description

function shorten(str) {
  if (str.length > 1000) {
      return str.substring(0, 1001) + '...';
  } else {
      return str;
  }
}

You could optionally make pages in your embed that divides ur queue into two parts and shows the second list when reacting

about 4 years ago · Juan Pablo Isaza Report
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!