{"record":{"id":"52ab3cad1b14cc77","repo":"supermemoryai/supermemory","slug":"supermemory-profile-search-failed-response-stat-52ab3c","errorCode":null,"errorMessage":"Supermemory profile search failed: ${response.status} ${response.statusText}. ${errorText}","messagePattern":"Supermemory profile search failed: (.+?) (.+?)\\. (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/shared/memory-client.ts","lineNumber":53,"sourceCode":"\t\t\t})\n\t\t: JSON.stringify({\n\t\t\t\tcontainerTag: containerTag,\n\t\t\t})\n\n\ttry {\n\t\tconst response = await fetch(`${baseUrl}/v4/profile`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\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","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/shared/memory-client.ts#L35-L71","documentation":"supermemoryProfileSearch in the shared memory client throws when the profile-search HTTP call returns a non-OK status, embedding status, statusText, and the response body text. This is the core client used by middleware variants for memory injection.","triggerScenarios":"Any memory-enhanced request path where the Supermemory search API responds 401/400/429/5xx, e.g. bad filter payload, expired key, or rate limiting during bursts of chat requests.","commonSituations":"High chat volume hitting rate limits; API schema changes to the search payload; key rotated but stale in deployed env.","solutions":["Parse the status from the message and fix the matching cause (auth, payload, rate limit)","Reduce request frequency or batch queries to stay under rate limits","Keep the SDK updated to match the current API schema","Wrap memory search in try/catch and fall back to a plain completion"],"exampleFix":"// before\nconst res = await supermemoryProfileSearch(payload)\n\n// after\nlet res\ntry {\n  res = await supermemoryProfileSearch(payload)\n} catch (e) {\n  logger.warn('memory search failed, degrading', e)\n  res = { results: [] }\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await supermemoryProfileSearch(payload) } catch (e) { logger.warn('memory search unavailable', e); return { results: [] } }","preventionTips":["Cache recent search results to reduce call volume","Handle rate limits with client-side throttling"],"tags":["http","api","search","supermemory"],"backgroundTag":"api-request-failed","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}