{"record":{"id":"327ec22271074c02","repo":"supermemoryai/supermemory","slug":"supermemory-retrieval-failed-continuing-without-i","errorCode":null,"errorMessage":"Supermemory retrieval failed; continuing without injected memories","messagePattern":"Supermemory retrieval failed; continuing without injected memories","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/tools/src/vercel/index.ts","lineNumber":160,"sourceCode":"\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\n\n\t// Proxy keeps prototype/getter fields (e.g. provider, modelId) that `{ ...model }` drops.\n\treturn new Proxy(model, {\n\t\tget(target, prop, receiver) {\n\t\t\tif (prop === \"doGenerate\") {\n\t\t\t\treturn async (params: LanguageModelCallOptions) => {\n\t\t\t\t\tlet modelParams: LanguageModelCallOptions = params\n\t\t\t\t\ttry {\n\t\t\t\t\t\tmodelParams = await transformParamsWithMemory(params, ctx)\n\t\t\t\t\t} catch (memoryError) {\n\t\t\t\t\t\tif (skipMemoryOnError) {\n\t\t\t\t\t\t\tctx.logger.warn(\n\t\t\t\t\t\t\t\t\"Supermemory retrieval failed; continuing without injected memories\",\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\t\t\tmemoryError instanceof Error\n\t\t\t\t\t\t\t\t\t\t\t? memoryError.message\n\t\t\t\t\t\t\t\t\t\t\t: \"Unknown error\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tmodelParams = params\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tctx.logger.error(\"Error during memory retrieval for generation\", {\n\t\t\t\t\t\t\t\terror:\n\t\t\t\t\t\t\t\t\tmemoryError instanceof Error\n\t\t\t\t\t\t\t\t\t\t? memoryError.message\n\t\t\t\t\t\t\t\t\t\t: \"Unknown error\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tthrow memoryError\n\t\t\t\t\t\t}","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/vercel/index.ts#L142-L178","documentation":"Warned (only when skipMemoryOnError is enabled) that the attempt to retrieve memories and inject them into the Vercel AI SDK model call failed, so the request proceeds without injected memories. The original error message from transformParamsWithMemory is attached. It is a graceful-degradation path: the LLM call still happens, just without personalization context.","triggerScenarios":"wrapLanguageModel/wrapper context where the Supermemory search API call inside transformParamsWithMemory throws — invalid/missing API key, malformed filter JSON, bad timeRange, network failure, or non-2xx from the Supermemory endpoints — and skipMemoryOnError defaults to true.","commonSituations":"Missing or rotated SUPERMEMORY_API_KEY, stale SDK version sending params the API rejects, transient network outages in edge/serverless runtimes, malformed projectFilter/filter JSON passed to the wrapper options.","solutions":["Inspect the logged error field to identify the root cause (auth vs validation vs network)","Verify the Supermemory API key and tool configuration (projectFilter JSON validity, correct endpoint)","If failures should fail loudly instead of silently degrading, set skipMemoryOnError: false","Retry with backoff for transient network errors; check Supermemory status and SDK changelog for breaking param changes"],"exampleFix":"// before\nconst result = await generateText({ model: wrapped, prompt })\n// silently no memories when retrieval fails\n\n// after\nconst wrapped = wrapLanguageModel({\n  model,\n  middleware: supermemoryMiddleware({\n    skipMemoryOnError: false, // surface retrieval errors instead of degrading\n  }),\n});","handlingStrategy":"try-catch","validationCode":"if (!process.env.SUPERMEMORY_API_KEY) {\n  throw new Error('SUPERMEMORY_API_KEY is required for memory injection');\n}","typeGuard":"const hasMemoryConfig = (c: unknown): c is { apiKey: string } =>\n  typeof c === 'object' && c !== null && typeof (c as any).apiKey === 'string' && (c as any).apiKey.length > 0;","tryCatchPattern":"try {\n  const result = await generateText({ model: wrapped, prompt });\n} catch (e) {\n  // when skipMemoryOnError: false, retrieval failures throw here;\n  // decide whether to retry without the middleware or surface the error\n  if (e instanceof Error && /supermemory/i.test(e.message)) { /* handle */ }\n  throw e;\n}","preventionTips":["Validate API key presence at startup","Keep skipMemoryOnError: false in dev so retrieval failures are visible","Log the error metadata attached to the warning to catch config mistakes early"],"tags":["typescript","vercel-ai-sdk","graceful-degradation","memory-retrieval","api-key"],"backgroundTag":"optional-dependency-graceful-degradation","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}