{"record":{"id":"6133b2c10bd6e18b","repo":"tonhowtf/omniget","slug":"omnidisc-invite-could-not-be-redeemed","errorCode":null,"errorMessage":"[omnidisc] invite could not be redeemed","messagePattern":"\\[omnidisc\\] invite could not be redeemed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-store.svelte.ts","lineNumber":1526,"sourceCode":"    streaming: pending.streaming,\n    insecure: pending.insecure,\n  });\n  selectedInstanceId = instance.id;\n  connectStep = \"syncing\";\n  try {\n    await connectGateway(instance);\n    if (instance.status !== \"connected\") await waitForReady(pending.url);\n  } catch (e) {\n    failConnect(e);\n    return null;\n  }\n  if (joinInvite && pending.invite) {\n    try {\n      const raw = await invoke<unknown>(\"omnidisc_join_invite\", { url: pending.url, code: pending.invite });\n      const guild = parseGuild(raw, instance.id);\n      if (guild) upsertGuild(instance.id, guild);\n    } catch (e) {\n      console.warn(\"[omnidisc] invite could not be redeemed\", errorText(e));\n    }\n  }\n  connectedInstance = instance;\n  connectStep = \"done\";\n  return instance;\n}\n\nexport async function connectInstance(url: string, invite?: string): Promise<OmnidiscInstance | null> {\n  ensureLoaded();\n  connectStep = \"connecting\";\n  connectError = null;\n  connectedInstance = null;\n  pendingConnect = null;\n  let result: ConnectResult;\n  try {\n    result = await invoke<ConnectResult>(\"omnidisc_connect\", {\n      url,\n      invite: invite && invite.trim().length > 0 ? invite.trim() : null,","sourceCodeStart":1508,"sourceCodeEnd":1544,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-store.svelte.ts#L1508-L1544","documentation":"After connecting to an instance with a pending invite, the store calls `omnidisc_join_invite` on the backend to redeem the invite code. If redemption fails, the warning is logged, the guild is not upserted, but the connection still completes (`connectedInstance = instance; connectStep = \"done\"`) — the user is connected but did not join the invited guild.","triggerScenarios":"Connecting via an invite link when `omnidisc_join_invite` rejects: the invite code is expired/revoked/invalid, the user lacks permission to join, the server rejects the join, or the response fails parseGuild so no guild is returned.","commonSituations":"Sharing invite links after they expired; already being a member (some servers error on re-join); banned from the target guild; typo'd or truncated invite code in a copied link; instance API changed its join response shape.","solutions":["Read errorText(e) for the server's join rejection reason (invalid/expired code, banned, already member)","Verify the invite code is current — generate a fresh invite on the target server","Check that parseGuild handles the backend's response shape; if the raw response is valid, fix the parser","After fixing, re-run the join explicitly rather than reconnecting the whole instance"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check the invite before joining\nconst code = pending.invite?.trim();\nif (!code || !/^[A-Za-z0-9-]+$/.test(code)) return;\n","typeGuard":null,"tryCatchPattern":"try {\n  const raw = await invoke(\"omnidisc_join_invite\", { url, code });\n  const guild = parseGuild(raw, instance.id);\n  if (guild) upsertGuild(instance.id, guild);\n} catch (e) {\n  console.warn(\"[omnidisc] invite could not be redeemed\", errorText(e));\n  // let connection complete; prompt user to retry the invite\n}","preventionTips":["Validate invite codes client-side before redeeming","Warn users when connection succeeded but the invite failed, so they can retry joining","Handle already-a-member and expired-code responses explicitly"],"tags":["svelte","invites","tauri","guild"],"backgroundTag":"api-request-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"}