supermemoryai/supermemory · error · Error
Supermemory profile search failed: ${response.status} ${resp
Error message
Supermemory profile search failed: ${response.status} ${response.statusText}. ${errorText} What it means
supermemoryProfileSearch in the OpenAI middleware throws when the POST to Supermemory's profile-search endpoint returns a non-OK HTTP status, embedding the status, status text, and response body in the message.
Source
Thrown at packages/tools/src/openai/middleware.ts:121
containerTag: containerTag,
})
: JSON.stringify({
containerTag: containerTag,
})
try {
const response = await fetch(`${baseUrl}/v4/profile`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${apiKey}`,
},
body: payload,
})
if (!response.ok) {
const errorText = await response.text().catch(() => "Unknown error")
throw new Error(
`Supermemory profile search failed: ${response.status} ${response.statusText}. ${errorText}`,
)
}
return await response.json()
} catch (error) {
if (error instanceof Error) {
throw error
}
throw new Error(`Supermemory API request failed: ${error}`)
}
}
/**
* Adds memory-enhanced system prompts to chat completion messages.
*
* Searches for relevant memories based on the specified mode and injects them
* into the conversation. If a system prompt already exists, memories are appendedView on GitHub (pinned to d436792e77)
Solutions
- Read the embedded status code and errorText to classify the failure
- Verify SUPERMEMORY_API_KEY is valid and has the right scope
- Check for payload/filter schema changes in the Supermemory API changelog
- Add retry with backoff for 429/5xx and degrade gracefully to non-memory completion
Example fix
// before
const memories = await supermemoryProfileSearch(payload)
// after
let memories
try {
memories = await supermemoryProfileSearch(payload)
} catch {
memories = { results: [] } // degrade to no-memory completion
} Defensive patterns
Strategy: fallback
Try / catch
let memories; try { memories = await supermemoryProfileSearch(payload) } catch (e) { logger.warn('memory search failed', e); memories = { results: [] } } // proceed without memories Prevention
- Degrade gracefully: memory search failure should not kill the chat request
- Retry 429/5xx with backoff
- Monitor error rates on the profile-search endpoint
When it happens
Trigger: The middleware issuing a profile search before chat completion and receiving 401 (bad API key), 400 (bad payload/filter), 429 (rate limit), or 5xx from the Supermemory API.
Common situations: Expired or wrong-scoped API key; invalid filter payload in newer API versions; hitting rate limits under load; regional endpoint outage.
Related errors
- Failed to add conversation: ${response.status} ${response.st
- containerTag is required — provide a non-empty string to ide
- customId is required — provide a non-empty string to group m
- Supermemory forget memory failed: ${response.status} ${respo
- Supermemory profile search failed: ${response.status} ${resp
AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28).
Data as JSON: /api/errors/c40c38eac062e8b9.
Report an issue: GitHub.