{"record":{"id":"2cc4a27ed057071d","repo":"supermemoryai/supermemory","slug":"supermemory-api-request-failed-error-2cc4a2","errorCode":null,"errorMessage":"Supermemory API request failed: ${error}","messagePattern":"Supermemory API request failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/shared/memory-client.ts","lineNumber":63,"sourceCode":"\t\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t},\n\t\t\tbody: payload,\n\t\t\t...(signal ? { signal } : {}),\n\t\t})\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text().catch(() => \"Unknown error\")\n\t\t\tthrow new Error(\n\t\t\t\t`Supermemory profile search failed: ${response.status} ${response.statusText}. ${errorText}`,\n\t\t\t)\n\t\t}\n\n\t\treturn await response.json()\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tthrow error\n\t\t}\n\t\tthrow new Error(`Supermemory API request failed: ${error}`)\n\t}\n}\n\n/**\n * Options for building memories text.\n */\nexport interface BuildMemoriesTextOptions {\n\tcontainerTag: string\n\tqueryText: string\n\tmode: MemoryMode\n\tbaseUrl: string\n\tapiKey: string\n\tlogger: Logger\n\tpromptTemplate?: PromptTemplate\n\tsignal?: AbortSignal\n}\n\n/**","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/shared/memory-client.ts#L45-L81","documentation":"Catch-all in the shared memory client's supermemoryProfileSearch that wraps non-Error rejections (strings, objects, abort DOMExceptions) into a proper Error so downstream code can rely on instanceof Error. The original value appears in the message.","triggerScenarios":"fetch rejecting with an abort/timeout signal or a non-Error value in certain runtimes (edge runtimes, older Node, polyfilled fetch).","commonSituations":"Requests exceeding the timeout on slow connections; edge runtimes with non-standard fetch behavior.","solutions":["Inspect the message to identify the underlying rejection (abort, network, custom fetch)","Handle timeouts explicitly with retry or graceful degradation","Use a runtime with standards-compliant fetch rejection behavior"],"exampleFix":"// before\nawait supermemoryProfileSearch(payload)\n\n// after\ntry {\n  return await supermemoryProfileSearch(payload)\n} catch (e) {\n  if (e instanceof Error && e.message.toLowerCase().includes('abort')) return { results: [] }\n  throw e\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await supermemoryProfileSearch(p) } catch (e) { if (e instanceof Error && /abort|timeout/i.test(e.message)) return { results: [] }; throw e }","preventionTips":["Treat abort/timeout separately from HTTP errors","Configure an explicit signal you control"],"tags":["fetch","timeout","abort","supermemory"],"backgroundTag":"non-error-rejection","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}