Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DiscordAPIError[50035]: Response Exceeds 4000 Character Limit When Answering User Questions #892

Open
theimperious1 opened this issue Nov 19, 2024 · 0 comments

Comments

@theimperious1
Copy link
Collaborator

theimperious1 commented Nov 19, 2024

Description

When a user asks a question that generates a response exceeding Discord's 4000-character limit, the bot encounters the following error:

DiscordAPIError[50035]: Invalid Form Body
content[BASE_TYPE_MAX_LENGTH]: Must be 4000 or fewer in length.

Steps to Reproduce

  1. Ask a question (e.g "what number of drugs are out there") in the Discord server that prompts the bot to generate a 4000+ char response.
  2. Observe the bot failing to send the response and the error being logged.

Expected Behavior

It shouldn't get responses this long in the first place probably, but if it does, it should send in multiple messages (max 2) or end it off with 3 dots instead of an error. It should also not cause the user to get endlessly stuck no matter what they say.

Actual Behavior

The bot fails to send the response due to exceeding Discord's character limit, resulting in the above error. It also seems to interfere with future messages due to history so all future messages meet the same fate.

Suggested potential Fix(s)

  • Worst: Implement logic to split long messages into multiple parts and send them sequentially.
  • Second best: truncate the response.
  • Best: prevent GPT from sending responses this long at all.

Additional Context

Error reported by .•777•.ÒwÓ• / cyp888. on Discord.
This issue may affect other users if questions result in lengthy answers.

Environment

  • Bot: [g.ai]
  • API: Discord
  • Error ID: 50035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant