{"record":{"id":"37eb74a9acb44fcc","repo":"supermemoryai/supermemory","slug":"customid-is-required-provide-a-non-empty-string-37eb74","errorCode":null,"errorMessage":"customId is required — provide a non-empty string to group messages into a single document","messagePattern":"customId is required — provide a non-empty string to group messages into a single document","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/vercel/index.ts","lineNumber":130,"sourceCode":" * ```\n *\n * @throws {Error} When neither `options.apiKey` nor `process.env.SUPERMEMORY_API_KEY` are set\n * @throws {Error} When supermemory memory retrieval fails and `skipMemoryOnError` is `false`\n */\nconst wrapVercelLanguageModel = <T extends LanguageModel>(\n\tmodel: T,\n\toptions: WrapVercelLanguageModelOptions,\n): T => {\n\tconst providedApiKey = options.apiKey ?? process.env.SUPERMEMORY_API_KEY\n\n\tif (!providedApiKey) {\n\t\tthrow new Error(\n\t\t\t\"SUPERMEMORY_API_KEY is not set — provide it via `options.apiKey` or set `process.env.SUPERMEMORY_API_KEY`\",\n\t\t)\n\t}\n\n\tif (!options.customId) {\n\t\tthrow new Error(\n\t\t\t\"customId is required — provide a non-empty string to group messages into a single document\",\n\t\t)\n\t}\n\n\tconst ctx = createSupermemoryContext({\n\t\tcontainerTag: options.containerTag,\n\t\tapiKey: providedApiKey,\n\t\tcustomId: options.customId,\n\t\tverbose: options.verbose ?? false,\n\t\tmode: options.mode ?? \"profile\",\n\t\taddMemory: options.addMemory ?? \"always\",\n\t\tbaseUrl: options.baseUrl,\n\t\tincludeToolCalls: options.includeToolCalls ?? false,\n\t\tpromptTemplate: options.promptTemplate,\n\t\tmemoryRetrievalTimeoutMs: DEFAULT_MEMORY_RETRIEVAL_TIMEOUT_MS,\n\t})\n\n\tconst skipMemoryOnError = options.skipMemoryOnError ?? true","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/vercel/index.ts#L112-L148","documentation":"wrapVercelLanguageModel requires options.customId, which groups all messages of a conversation into one Supermemory document. Without it the wrapper cannot attribute streamed LLM exchanges to a memory document.","triggerScenarios":"Calling wrapVercelLanguageModel(model, { apiKey }) (or with containerTag only) with customId missing/empty.","commonSituations":"Adapting examples that predate the customId requirement; deriving customId from an optional chat id that is undefined on first message.","solutions":["Pass a stable customId per conversation (chat/session id)","Generate crypto.randomUUID() when a conversation starts and reuse it for its lifetime","Validate options once at module init so failures surface at boot, not mid-request"],"exampleFix":"// before\nwrapVercelLanguageModel(model, { apiKey })\n\n// after\nwrapVercelLanguageModel(model, { apiKey, customId: chatId ?? crypto.randomUUID() })","handlingStrategy":"validation","validationCode":"if (!options?.customId) throw new TypeError('customId required')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Thread a conversation id through your AI stream handler","Default to crypto.randomUUID() when no natural id exists"],"tags":["validation","vercel","configuration","supermemory"],"backgroundTag":"missing-required-option","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}