too_many_attachments
More files than the channel takes in one request (5). Nothing was sent; split them across requests.
When it fires
A POST /v1/conversations/{id}/messagescarried more files than the conversation's channel takes in one request. Airbnb and Booking.com both take up to 5. channel in the error names the channel.
Nothing was sent. A request with more than 5 entries in attachments is usually refused even earlier, as 422 invalid_params with field: "attachments"; both mean the same thing and have the same fix.
Response shape
Every Repull error follows the same envelope. The code is stable and safe to switch on.
{
"error": {
"code": "too_many_attachments",
"message": "At most 5 attachments per request on airbnb (received 6). Nothing was sent.",
"fix": "Split the files across several requests of up to 5.",
"docs_url": "https://repull.dev/docs/errors/too_many_attachments",
"request_id": "req_01J5X7Y8Z9ABCDEF12345678",
"channel": "airbnb"
}
}How to fix
- Split the files into groups of at most 5.
- Send one request per group, each with its own `Idempotency-Key`.
- On Booking.com every request needs `message` text, so give each group a short line of its own.
Examples
curl
# First five files
curl -X POST https://api.repull.dev/v1/conversations/164743/messages \
-H "Authorization: Bearer sk_live_YOUR_KEY" \
-H "Idempotency-Key: photos-164743-part-1" \
-H "Content-Type: application/json" \
-d '{"message": "Photos of the apartment (1/2)", "attachments": [
{"url": "https://cdn.example.com/1.jpg"}, {"url": "https://cdn.example.com/2.jpg"},
{"url": "https://cdn.example.com/3.jpg"}, {"url": "https://cdn.example.com/4.jpg"},
{"url": "https://cdn.example.com/5.jpg"}]}'TypeScript
const files = photoUrls.map((url) => ({ url }))
for (let i = 0; i < files.length; i += 5) {
const batch = files.slice(i, i + 5)
const res = await fetch('https://api.repull.dev/v1/conversations/164743/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.REPULL_API_KEY}`,
'Content-Type': 'application/json',
'Idempotency-Key': `photos-164743-${i / 5}`,
},
body: JSON.stringify({ message: `Photos (${i / 5 + 1})`, attachments: batch }),
})
if (!res.ok) throw new Error((await res.json()).error.code)
}If you're an AI agent
More than 5 files in one message request. Nothing was sent. Split the files into batches of up to 5 and send one request per batch.
Related
- Error reference — the full table of error codes
- Using Repull from AI agents — patterns for handling errors in agent loops
- Sending attachments
- invalid_params
Hit an error that isn't covered? Email hello@repull.dev with the request id from the response headers.