supermemoryai/supermemory · error · Error
customId is required — provide a non-empty string to group m
Error message
customId is required — provide a non-empty string to group messages into a single document
What it means
The OpenAI middleware's withSupermemory requires options.customId, which groups the messages of one conversation into a single Supermemory document. Without it the middleware cannot decide which document a chat belongs to.
Source
Thrown at packages/tools/src/openai/index.ts:77
* ```
*
* @throws {Error} When neither `options.apiKey` nor `process.env.SUPERMEMORY_API_KEY` are set
* @throws {Error} When supermemory API request fails
*/
export function withSupermemory(
openaiClient: OpenAI,
options: OpenAIMiddlewareOptions,
) {
validateApiKey(options.apiKey)
if (!options.containerTag) {
throw new Error(
"containerTag is required — provide a non-empty string to identify the user/container",
)
}
if (!options.customId) {
throw new Error(
"customId is required — provide a non-empty string to group messages into a single document",
)
}
const { containerTag } = options
const verbose = options.verbose ?? false
const mode = options.mode ?? "profile"
const addMemory = options.addMemory ?? "always"
const openaiWithSupermemory = createOpenAIMiddleware(
openaiClient,
containerTag,
{
...options,
verbose,
mode,
addMemory,
},View on GitHub (pinned to d436792e77)
Solutions
- Pass a stable non-empty customId per conversation/session
- Generate one (e.g. crypto.randomUUID()) at conversation start if you don't have a natural id
- Validate options before wiring the middleware at app startup
Example fix
// before
withSupermemory(openai, { containerTag: 'user-1' })
// after
withSupermemory(openai, { containerTag: 'user-1', customId: conversationId }) Defensive patterns
Strategy: validation
Validate before calling
if (!options?.customId) throw new TypeError('customId required') Prevention
- Assign a conversation id at conversation start and thread it through
- Type options as Required<Pick<..., 'customId'>> in your own wrappers
When it happens
Trigger: Calling withSupermemory with customId omitted, empty, or undefined (e.g. generated per-request but occasionally falsy).
Common situations: Reusing old examples that only passed containerTag; computing customId from an optional query param that is missing; typo like customID.
Related errors
- containerTag is required — provide a non-empty string to ide
- Supermemory profile search failed: ${response.status} ${resp
- withSupermemory: options must be an object with required con
- Responses API is not available in this OpenAI client version
- Supermemory tools config accepts either projectId or contain
AI-assisted analysis of supermemoryai/supermemory@d436792e77 (2026-08-28).
Data as JSON: /api/errors/751fdc57ac53bd74.
Report an issue: GitHub.