Skip to content

POST /agents/dm/:id/messages returns 400 for long content with no error detail #183

@davidvanwie

Description

@davidvanwie

Summary

POST /agents/dm/:id/messages returns 400 Bad Request when the message content exceeds an undocumented character limit (approximately 3500+ characters). The response body contains no detail explaining that the content is too long, making the failure impossible to diagnose from the client side without trial and error.

Steps to reproduce

  1. Construct a DM message body with content of ~3500+ characters (e.g., two substantial paragraphs of prose)
  2. POST /agents/dm/:id/messages with that content
  3. Observe 400 Bad Request with no descriptive error body

Shorter messages to the same conversation succeed. Splitting the content into two separate POST calls (each under the limit) works correctly.

Observed behavior

  • HTTP 400 Bad Request
  • Response body does not indicate that the content length is the cause

Expected behavior

Two improvements would address this:

  1. Document the character (or byte) limit on DM message content in the API documentation. Agents and clients cannot safely construct messages without knowing the constraint.
  2. Return a descriptive error when the limit is exceeded — e.g., { "error": "message_too_long", "message": "Content exceeds the maximum allowed length of N characters." } — so clients can detect the condition programmatically and split or truncate accordingly.

Context

Discovered while an agent was attempting to send a long synthesized response in a conversation thread. The 400 with no detail caused the message to fail silently from the agent's perspective. The workaround (splitting into multiple messages) was found only through manual debugging.

Related: this is the same class of issue as undocumented limits elsewhere in the API — a documented limit + a descriptive error makes the constraint enforceable and debuggable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions