{"record":{"id":"877b1cd0028815c7","repo":"tonhowtf/omniget","slug":"omnidisc-could-not-sign-out-of","errorCode":null,"errorMessage":"[omnidisc] could not sign out of","messagePattern":"\\[omnidisc\\] could not sign out of","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-store.svelte.ts","lineNumber":367,"sourceCode":"  clearInstanceData(id);\n  instances = instances.filter((i) => i.id !== id);\n  if (selectedInstanceId === id) {\n    selectedInstanceId = instances[0]?.id ?? null;\n    selectedGuildId = null;\n    selectedChannelId = null;\n  }\n  persist();\n  if (instance && !isDemo(id)) {\n    void forgetRemote(instance.url);\n  }\n}\n\nasync function forgetRemote(url: string) {\n  try {\n    await invoke(\"omnidisc_gateway_disconnect\", { url });\n    await invoke(\"omnidisc_logout\", { url });\n  } catch (e) {\n    console.warn(\"[omnidisc] could not sign out of\", url, errorText(e));\n  }\n}\n\nexport async function signOut(id: string) {\n  const instance = instances.find((i) => i.id === id);\n  if (!instance || isDemo(id)) return;\n  try {\n    await invoke(\"omnidisc_logout\", { url: instance.url });\n  } catch {\n    // token is dropped locally even if the server did not answer\n  }\n  clearInstanceData(id);\n  setInstanceStatus(id, \"signed_out\");\n}\n\nexport function setInstanceStatus(id: string, status: InstanceStatus, error?: string) {\n  const instance = instances.find((i) => i.id === id);\n  if (!instance) return;","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-store.svelte.ts#L349-L385","documentation":"During forgetRemote (invoked by removeInstance), the store attempts to disconnect the gateway and log the user out on the backend via two invoke() calls (`omnidisc_gateway_disconnect`, `omnidisc_logout`). If either backend command rejects — the instance is already unreachable, the session/token is already gone, or the backend command errors — the catch block logs a warning that sign-out failed. The local instance removal continues regardless; only server-side sign-out was skipped.","triggerScenarios":"Calling removeInstance(id) → forgetRemote(url) when the backend `omnidisc_gateway_disconnect` or `omnidisc_logout` command rejects: gateway socket already closed, instance server offline, invalid/expired stored session token, or command not registered in the backend.","commonSituations":"Removing an instance whose server has been taken down; stale auth tokens after server restart or password change; testing demo/local setups where no real backend endpoint exists; version mismatch where the Tauri command was renamed.","solutions":["Check the logged errorText(e) to see which invoke failed and why (network vs auth vs missing command)","Verify the Tauri backend registers `omnidisc_gateway_disconnect` and `omnidisc_logout` handlers","Confirm the instance URL is reachable; if the server is gone, treat failed sign-out as acceptable and proceed with local removal","Clear stale credentials/instance state locally after repeated sign-out failures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// before removing\nif (!instances.some((i) => i.url === url)) return;\n","typeGuard":null,"tryCatchPattern":"try {\n  await invoke(\"omnidisc_gateway_disconnect\", { url });\n  await invoke(\"omnidisc_logout\", { url });\n} catch (e) {\n  console.warn(\"[omnidisc] could not sign out of\", url, errorText(e));\n  // proceed with local removal anyway\n}","preventionTips":["Treat server-side sign-out as best-effort; always finish local cleanup independently","Check gateway connectivity before attempting remote sign-out","Surface a toast when sign-out fails so users know server state may persist"],"tags":["tauri","svelte","logout","network"],"backgroundTag":"logout-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}