DiscordAPIError[50035]: Invalid Form Body when sending a message or embed
DiscordAPIError[50035]: Invalid Form BodyShort answer
Error 50035 means the request body or its Content-Type is invalid. For messages the usual reasons are text over 2000 characters, an empty message with nothing to send, or an embed that breaks a size limit. Print the whole error object to see which field failed.
Fix it fast
1Find out which cause you have
Print the full error, not only its message. Look for the field name in it: content points to the first cause below, embeds to the third.
try { await channel.send(payload); } catch (err) { console.error(err); }2Match what you see, then jump to its fix
- 1
The failing field in the error is contentThe message text is longer than 2000 charactersFix - 2
The error appears when a variable is empty or undefined, for instance a reply built from an empty API resultThe message has nothing to sendFix - 3
The failing field path starts with embedsAn embed breaks a size limitFix
- 1
What does the error look like?
DiscordAPIError[50035]: Invalid Form Body
Cause 1 of 3
The message text is longer than 2000 characters
1Check
Discord accepts up to 2000 characters in the content field of a message.
console.log(payload.content?.length);2Fix
Split the text into chunks of at most 2000 characters, or send long output as a file attachment.
for (let i = 0; i < text.length; i += 2000) {
await channel.send(text.slice(i, i + 2000));
}3Verify
Every chunk is accepted.
console.log(Math.max(...chunks.map(c => c.length)));Confirmed by docs.discord.com
Cause 2 of 3
The message has nothing to send
1Check
At least one of content, embeds, sticker_ids, components, files, poll or shared_client_theme is required. An empty string with no embed or file therefore fails.
console.log(JSON.stringify(payload));2Fix
Guard the send call so an empty payload is skipped or replaced with a fallback text.
if (!payload.content && !payload.embeds?.length && !payload.files?.length) {
payload = { content: 'No results.' };
}3Verify
The send succeeds with an empty source.
await channel.send(payload);Confirmed by docs.discord.com
Cause 3 of 3
An embed breaks a size limit
1Check
Per embed: title 256 characters, description 4096, up to 25 fields, field name 256, field value 1024, footer text 2048, author name 256. All embeds in one message share a 6000-character total, and a message holds up to 10 embeds.
const e = payload.embeds?.[0];
console.log(e?.title?.length, e?.description?.length, e?.fields?.length);2Fix
Trim each field to its limit, and move extra content into a second message.
const cut = (s, n) => (s.length > n ? s.slice(0, n - 1) + '…' : s);
embed.title = cut(embed.title, 256);
embed.description = cut(embed.description, 4096);3Verify
Resend the embed.
await channel.send({ embeds: [embed] });Confirmed by docs.discord.com
How do I stop it coming back?
- Validate lengths before every send; the limits are fixed and documented.
- Log the raw error body in your error handler so the failing field is never hidden.
- Send long output as an attachment rather than as message text.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fixBack end
The command npm run build -- --prod exited with code 1 (Angular)
The command "npm run build -- --prod" exited with code 1
Exit code 1 only says the build failed; the real message is above it.
2 causes, each with a fix