{"record":{"id":"9f9013e79494b1c4","repo":"tonhowtf/omniget","slug":"omnidisc-could-not-read-the-group-status","errorCode":null,"errorMessage":"[omnidisc] could not read the group status","messagePattern":"\\[omnidisc\\] could not read the group status","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-store.svelte.ts","lineNumber":2512,"sourceCode":"    const members = (Array.isArray(raw.members) ? raw.members : [])\n      .filter(isRecord)\n      .map((m) => ({\n        userId: str(m.user_id) ?? \"\",\n        deviceId: str(m.device_id) ?? \"\",\n        fingerprint: str(m.fingerprint) ?? \"\",\n        isMe: m.is_me === true,\n      }));\n    groupStatusByChannel = {\n      ...groupStatusByChannel,\n      [channelId]: {\n        ready: raw.ready === true,\n        groupId: str(raw.group_id) ?? \"\",\n        epoch: typeof raw.epoch === \"number\" ? raw.epoch : undefined,\n        members,\n      },\n    };\n  } catch (e) {\n    console.warn(\"[omnidisc] could not read the group status\", errorText(e));\n  }\n}\n\nexport async function getUploadLimits(instanceId: string) {\n  const cached = limitsByInstance[instanceId];\n  if (cached) return cached;\n  const instance = getInstance(instanceId);\n  if (!instance) return { maxUploadBytes: 0, maxAttachments: 10 };\n  try {\n    const raw = await invoke<unknown>(\"omnidisc_instance_limits\", { url: instance.url });\n    const limits = isRecord(raw) && isRecord(raw.limits) ? raw.limits : {};\n    const value = {\n      maxUploadBytes:\n        typeof limits.max_upload_bytes === \"number\"\n          ? limits.max_upload_bytes\n          : typeof (raw as Record<string, unknown>).max_upload_bytes === \"number\"\n            ? ((raw as Record<string, unknown>).max_upload_bytes as number)\n            : 0,","sourceCodeStart":2494,"sourceCodeEnd":2530,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-store.svelte.ts#L2494-L2530","documentation":"This catch guards the store's group-status reader: it builds an OmnidiscGroupStatus from a raw backend record (group id, epoch, member list) and, if fetching/parsing the record throws, logs this warning and returns undefined. Callers of getGroupStatus will simply see null — encrypted-channel group membership state is unavailable.","triggerScenarios":"Reading the encrypted-group state for a channel when the backend group-status command rejects or the raw record fails field extraction (missing group_id/epoch/members): group not yet initialized for the channel, malformed persisted group state, or membership decryption failure.","commonSituations":"Joining an encrypted channel before its group/mLS tree is initialized; another member rotated the group epoch and local state is stale; corrupted persisted group state after a crash; schema drift between backend writer and frontend parser.","solutions":["Check errorText(e) for whether the group record is missing vs malformed","Trigger a group status refresh/re-sync (the epoch may have advanced and needs the latest group state)","Verify the raw record fields (group_id, epoch, members) match the parser's expectations","If the group was never initialized, initialize it via the channel's group-setup flow before reading status"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// treat missing group state as 'not initialized' before parsing\nconst raw = await invoke<unknown>(\"omnidisc_group_status\", { channelId }).catch(() => null);\nif (!raw) return;\n","typeGuard":"function hasGroupFields(raw: unknown): raw is { group_id?: unknown; epoch?: unknown; members?: unknown[] } {\n  return typeof raw === \"object\" && raw !== null;\n}\n","tryCatchPattern":"try {\n  const status = parseGroupStatus(raw);\n  groupStatusByChannel[channelId] = status;\n} catch (e) {\n  console.warn(\"[omnidisc] could not read the group status\", errorText(e));\n}","preventionTips":["Default missing group state to null rather than throwing at call sites","Validate raw group records (group_id, epoch, members) before constructing status","Re-sync group state when the reported epoch is older than a peer's epoch"],"tags":["svelte","encryption","group-state","tauri"],"backgroundTag":"cache-read-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}