{"record":{"id":"b207e8ede48d3cb7","repo":"supermemoryai/supermemory","slug":"supermemory-forget-memory-failed-response-statu","errorCode":null,"errorMessage":"Supermemory forget memory failed: ${response.status} ${response.statusText}. ${errorText}","messagePattern":"Supermemory forget memory failed: (.+?) (.+?)\\. (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tools/src/shared/forget-memory.ts","lineNumber":41,"sourceCode":"export async function forgetMemoryRequest(\n\tapiKey: string,\n\tparams: ForgetMemoryParams,\n\tbaseUrl: string = DEFAULT_BASE_URL,\n\toptions?: ForgetMemoryRequestOptions,\n): Promise<void> {\n\tconst response = await fetch(`${baseUrl}/v4/memories`, {\n\t\tmethod: \"DELETE\",\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t},\n\t\tbody: JSON.stringify(params),\n\t\tsignal: options?.signal ?? AbortSignal.timeout(FETCH_TIMEOUT_MS),\n\t})\n\n\tif (!response.ok) {\n\t\tconst errorText = await response.text().catch(() => \"Unknown error\")\n\t\tthrow new Error(\n\t\t\t`Supermemory forget memory failed: ${response.status} ${response.statusText}. ${errorText}`,\n\t\t)\n\t}\n}\n","sourceCodeStart":23,"sourceCodeEnd":46,"githubUrl":"https://github.com/supermemoryai/supermemory/blob/d436792e777a99865939dd543c8d1a16d57f54ec/packages/tools/src/shared/forget-memory.ts#L23-L46","documentation":"forgetMemoryRequest throws when the Supermemory forget/delete endpoint returns a non-OK status. The message carries the HTTP status, status text, and response body so the failure is diagnosable from logs alone.","triggerScenarios":"Invoking the memoryForgetTool / createMemoryForgetFunction with a memoryId that doesn't exist (404), invalid API key (401), or when the API rejects the payload (400). Also thrown if the request exceeds FETCH_TIMEOUT_MS and the abort surfaces as a failed response path.","commonSituations":"Agent tools trying to forget already-deleted memories; wrong API key environment; timeouts on slow networks.","solutions":["Check the status code embedded in the message (404 = memory already gone, 401 = key, 400 = payload)","Treat 404 as success (idempotent forget) where appropriate","Verify API key and retry transient 5xx with backoff","Pass a custom options.signal to control cancellation"],"exampleFix":"// before\nawait forgetMemoryRequest({ memoryId })\n\n// after\ntry {\n  await forgetMemoryRequest({ memoryId })\n} catch (e) {\n  if (e instanceof Error && e.message.includes('404')) return { ok: true }\n  throw e\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await forgetMemoryRequest({ memoryId }) } catch (e) { if (e instanceof Error && /404/.test(e.message)) return { ok: true } /* idempotent */; throw e }","preventionTips":["Treat 404 forget as success in agent tool handlers","Retry transient 5xx with backoff"],"tags":["http","api","memory","supermemory"],"backgroundTag":"api-request-failed","analyzedSha":"d436792e777a99865939dd543c8d1a16d57f54ec","analyzedAt":"2026-08-28T18:04:46.947Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}