{"record":{"id":"96c8ebac8e76ad36","repo":"mem0ai/mem0","slug":"unauthorized","errorCode":null,"errorMessage":"Unauthorized","messagePattern":"Unauthorized","errorType":"http","errorClass":"Error","httpStatus":401,"severity":"error","filePath":"server/dashboard/src/utils/api.ts","lineNumber":99,"sourceCode":"\n      return Promise.reject(error);\n    },\n  );\n\n  const postStream = async (url: string, data: unknown): Promise<Response> => {\n    const response = await fetch(`${process.env.NEXT_PUBLIC_API_URL}${url}`, {\n      method: \"POST\",\n      headers: {\n        \"Content-Type\": \"application/json\",\n        Authorization: cachedToken ? `Bearer ${cachedToken}` : \"\",\n      },\n      body: JSON.stringify(data),\n    });\n\n    if (response.status === 401) {\n      handleTokenError();\n      redirectToLogin();\n      throw new Error(\"Unauthorized\");\n    }\n\n    if (!response.ok) {\n      const errorData = await response.json().catch(() => ({}));\n      throw new Error(errorData.error || \"Request failed\");\n    }\n\n    return response;\n  };\n\n  return Object.assign(api, { postStream });\n};\n\nexport const api = createApi();\n","sourceCodeStart":81,"sourceCodeEnd":114,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/server/dashboard/src/utils/api.ts#L81-L114","documentation":"Error \"Unauthorized\" thrown in mem0ai/mem0.","triggerScenarios":"Thrown at server/dashboard/src/utils/api.ts:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log in again; your session token is missing or expired.","Verify the Authorization header is being sent with a valid Bearer token.","Check that the API base URL points to the correct server."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}