{"record":{"id":"fcf29e8d14f57eb6","repo":"ollama/ollama","slug":"failed-to-disconnect-user","errorCode":null,"errorMessage":"Failed to disconnect user","messagePattern":"Failed to disconnect user","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/ui/app/src/api.ts","lineNumber":100,"sourceCode":"    const data = await response.json();\n    if (data.signin_url) {\n      return data.signin_url;\n    }\n  }\n\n  throw new Error(\"Failed to fetch connect URL\");\n}\n\nexport async function disconnectUser(): Promise<void> {\n  const response = await fetch(`${API_BASE}/api/signout`, {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application/json\",\n    },\n  });\n\n  if (!response.ok) {\n    throw new Error(\"Failed to disconnect user\");\n  }\n}\n\nexport async function getChats(): Promise<ChatsResponse> {\n  const response = await fetch(`${API_BASE}/api/v1/chats`);\n  const data = await response.json();\n  return new ChatsResponse(data);\n}\n\nexport async function getChat(chatId: string): Promise<ChatResponse> {\n  const response = await fetch(`${API_BASE}/api/v1/chat/${chatId}`);\n  const data = await response.json();\n  return new ChatResponse(data);\n}\n\nexport async function getModels(query?: string): Promise<Model[]> {\n  try {\n    const { models: modelsResponse } = await ollama.list();","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/ollama/ollama/blob/e5a81899d014a847a08d47393351908b53d74008/app/ui/app/src/api.ts#L82-L118","documentation":"Thrown by disconnectUser() when POST {API_BASE}/api/signout returns a non-OK status. Unlike other helpers it does not include the response body or status, so the server logs are the only source of detail. It means the server received the signout request but refused or failed to process it.","triggerScenarios":"POST /api/signout returning 4xx/5xx (session backend down, auth provider unreachable, invalid/expired session token causing 400); API_BASE pointing to a stale server that predates the /api/signout route (404).","commonSituations":"Version mismatch where the UI is newer than the local server and /api/signout does not exist yet; ollama.com auth endpoint outage making the server unable to revoke the session; signing out while offline.","solutions":["Confirm the route exists on the server: curl -X POST http://localhost:11434/api/signout -o /dev/null -w '%{http_code}'","Update the Ollama server/app to matching versions","Check server logs for the underlying signout failure","If the server is unreachable for auth, the local session can often be cleared by restarting the app after the server recovers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await disconnectUser(); }\ncatch (e) { console.warn('signout failed', e); /* keep local signed-out state anyway */ }","preventionTips":["Treat signout as best-effort: local session state should clear even if the server call fails","Verify /api/signout exists on the server version you deploy against","Retry once after the server recovers if it returned 5xx"],"tags":["network","http","authentication","typescript"],"backgroundTag":null,"analyzedSha":"e5a81899d014a847a08d47393351908b53d74008","analyzedAt":"2026-08-15T05:34:15.336Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}