supermemoryai/supermemory · error · Error
containerTag is required — provide a non-empty string to ide
Error message
containerTag is required — provide a non-empty string to identify the user/container
What it means
The OpenAI middleware's withSupermemory requires options.containerTag because memories are scoped per user/container on Supermemory's side. An empty/missing containerTag means the middleware cannot attribute conversations to a user.
Source
Thrown at packages/tools/src/openai/index.ts:71
* // Use with Responses API - memories injected into instructions
* const response = await openaiWithSupermemory.responses.create({
* model: "gpt-4o",
* instructions: "You are a helpful coding assistant",
* input: "What's my favorite programming language?"
* })
* ```
*
* @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,View on GitHub (pinned to d436792e77)
Solutions
- Provide a non-empty containerTag identifying the user/tenant, e.g. 'user-<id>' or 'org-<id>'
- Derive containerTag from your auth session so it is never empty
- Add a startup assertion validating all required options
Example fix
// before
withSupermemory(openai, { customId: 'chat-1', apiKey })
// after
withSupermemory(openai, {
containerTag: `user-${session.userId}`,
customId: 'chat-1',
apiKey,
}) Defensive patterns
Strategy: validation
Validate before calling
if (!options?.containerTag) throw new TypeError('containerTag required') Prevention
- Derive containerTag from authenticated user id so it's always present
- Validate middleware options once at app startup
When it happens
Trigger: Calling withSupermemory(openai, { customId, apiKey }) without containerTag, or passing containerTag: '' / undefined.
Common situations: Copy-pasting a minimal example that omitted containerTag; dynamically computing containerTag from user data that is sometimes empty.
Related errors
- customId is required — provide a non-empty string to group m
- 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/517756e10b88b6fe.
Report an issue: GitHub.