supermemoryai/supermemory · error · Error
Failed to add conversation: ${response.status} ${response.st
Error message
Failed to add conversation: ${response.status} ${response.statusText}. ${errorText} What it means
addConversation throws when the HTTP POST to the Supermemory conversations endpoint returns a non-2xx status. The message includes the status code, status text, and response body for diagnosis.
Source
Thrown at packages/tools/src/conversations-client.ts:96
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${params.apiKey}`,
},
body: JSON.stringify({
conversationId: params.conversationId,
messages: params.messages,
containerTags: params.containerTags,
metadata: params.metadata,
entityContext: params.entityContext,
}),
})
if (!response.ok) {
const errorText = await response.text().catch(() => "Unknown error")
throw new Error(
`Failed to add conversation: ${response.status} ${response.statusText}. ${errorText}`,
)
}
return await response.json()
}
View on GitHub (pinned to d436792e77)
Solutions
- Inspect the status code and errorText in the message to identify 401 vs 400 vs 429 vs 5xx
- Verify the API key and baseUrl used by the client
- Log and validate the params payload shape before sending
- Retry with backoff for 429/5xx responses
Example fix
// before
await addConversation(params) // throws raw
// after
try {
await addConversation(params)
} catch (e) {
if (e instanceof Error && e.message.includes('401')) {
// refresh API key
}
throw e
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!params?.content) throw new TypeError('content is required for addConversation') Try / catch
try { await addConversation(params) } catch (e) { if (e instanceof Error && /401|403/.test(e.message)) rotateApiKey(); else if (/429|5\d\d/.test(e.message)) await retry(addConversation, params); else throw e } Prevention
- Validate payload shape client-side before posting
- Keep API key and baseUrl in validated config
- Retry 429/5xx with exponential backoff
When it happens
Trigger: Calling addConversation with an invalid/expired API key (401), malformed payload (400), wrong base URL, or when the API is down (5xx / network-level failure rendered as !response.ok).
Common situations: Missing SUPERMEMORY_API_KEY env var, pointing baseUrl at the wrong environment, sending entityContext or fields the API rejects, or rate limiting (429).
Related errors
- Supermemory profile search failed: ${response.status} ${resp
- Supermemory forget memory failed: ${response.status} ${respo
- Supermemory profile search failed: ${response.status} ${resp
- Failed to delete document
- withSupermemory: options must be an object with required con
AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28).
Data as JSON: /api/errors/7ba8d220fc639897.
Report an issue: GitHub.