tonhowtf/omniget · warning

[omnidisc] could not load messages

Error message

[omnidisc] could not load messages

What it means

When loading a channel's message history, the store fetches messages from the instance via backend commands, and on failure clears the `loadedChannels` marker, logs this warning, and clears the per-channel loading flag in `finally`. It means the initial page of messages for `channelId` could not be retrieved — the channel appears empty/pending rather than throwing to the UI.

Solutions

  1. Read errorText(e) to distinguish network failure from auth failure or permission denial
  2. Verify the instance URL is reachable and the gateway is connected (check gateway status events)
  3. Re-authenticate: sign out and back in to refresh the session token
  4. Retry loading the channel after connectivity is restored — loadedChannels was cleared so a retry is possible
Defensive patterns

Strategy: retry

Validate before calling

// guard before loading
if (loadedChannels.has(channelId) || loadingByChannel[channelId]) return;
const instance = instanceByUrl(url);
if (!instance) return;

Try / catch

try {
  await invoke("omnidisc_load_messages", { url, channelId });
} catch (e) {
  loadedChannels.delete(channelId);
  console.warn("[omnidisc] could not load messages", errorText(e));
}

Prevention

When it happens

Trigger: Opening/joining a channel while the gateway or REST fetch behind loadMessages rejects: instance server unreachable, invalid/expired session token, channel the user lacks permission to read, malformed response from the backend command.

Common situations: Server temporarily down or restarted; auth token revoked; user removed from guild but channel still in local state; offline laptop reconnecting; backend command renamed or signature changed after an app update.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/a33a3033763fa2e4. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/stores/omnidisc-store.svelte.ts:771

  try {
    const raw = await invoke<unknown>("omnidisc_list_messages", { url: instance.url, channelId, limit: PAGE_SIZE });
    const list = Array.isArray(raw) ? raw : [];
    const resolve = nameResolver(instance.id);
    const parsed = list
      .map((m) => parseMessage(m, resolve))
      .filter((m): m is OmnidiscMessage => m !== null);
    hasMoreByChannel[channelId] = list.length >= PAGE_SIZE;
    const pending = (messagesByChannel[channelId] ?? []).filter((m) => m.delivery !== "sent");
    messagesByChannel = { ...messagesByChannel, [channelId]: sortMessages([...parsed, ...pending]) };
    for (const m of parsed) {
      bumpLastMessage(channelId, m.id);
      if (!usersByInstance[instance.id]?.[m.authorId]) void ensureUser(instance.id, m.authorId);
    }
    void hydrateEncrypted(channelId);
    void refreshGroupStatus(channelId);
  } catch (e) {
    loadedChannels.delete(channelId);
    console.warn("[omnidisc] could not load messages", errorText(e));
  } finally {
    const next = { ...loadingByChannel };
    delete next[channelId];
    loadingByChannel = next;
  }
}

export async function loadOlderMessages(channelId: string, count = PAGE_SIZE): Promise<number> {
  const current = messagesByChannel[channelId] ?? [];
  const instance = instanceForChannel(channelId);
  if (instance && isDemo(instance.id)) {
    const oldestSeq = oldestSeqByChannel[channelId];
    if (oldestSeq === undefined || oldestSeq <= 0) return 0;
    const endAt = (current[0]?.createdAt ?? Date.now()) - 60_000;
    const startSeq = Math.max(0, oldestSeq - count);
    const older = makeFixtureMessages(channelId, oldestSeq - startSeq, endAt, startSeq);
    oldestSeqByChannel[channelId] = startSeq;
    messagesByChannel = { ...messagesByChannel, [channelId]: [...older, ...current] };

View on GitHub (pinned to 8600b91f42)