jackwener/OpenCLI · error · EmptyResultError

gmail thread

gmail thread

Error message

No messages found for thread ${target}

What it means

After attempting capture-based parsing and a renderedThread fallback, if the deduplicated message list for the thread is still empty, fetchThread() throws EmptyResultError ('gmail thread'). It means navigation succeeded but no messages could be extracted for the thread.

Source

Thrown at clis/gmail/utils.js:606

    if (window.location.hash === target) window.location.hash = '#inbox';
    setTimeout(() => { window.location.hash = target; }, 50);
    return true;
  }`), 'thread navigation');
    if (navigated !== true) throw new CommandExecutionError('Gmail thread navigation failed');
  }
  let messages = [];
  try {
    const bodies = await waitGmailCaptures(page, 'fd', 'thread', 3);
    messages = bodies.flatMap(parseFetchData);
  } catch (error) {
    if (!(error instanceof TimeoutError)) throw error;
    await page.sleep(0.5);
    messages = await renderedThread(page, target);
    if (messages.length === 0) throw error;
  }
  const unique = [...new Map(messages.map((message) => [message.messageId, message])).values()];
  if (unique.length === 0) {
    throw new EmptyResultError('gmail thread', `No messages found for thread ${target}`);
  }
  return unique;
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run `gmail search` to confirm the thread still exists, then fetch again
  2. Retry — thread content can be slow to load; the library already retries with renderedThread
  3. Update the library if parsers no longer match Gmail's DOM
  4. Verify the thread id (a wrong id can land on an empty view)

Example fix

// before
const msgs = await fetchThread(page, staleThreadId);
// after
const fresh = await queryThreads(page, query); // re-resolve
if (fresh.length) { const msgs = await fetchThread(page, fresh[0].threadId); }
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try { msgs = await fetchThread(page, id); }
catch (e) { if (e instanceof EmptyResultError && e.code === 'gmail thread') { await page.sleep(2); msgs = await fetchThread(page, id).catch(() => []); } else throw e; }

Prevention

When it happens

Trigger: fetchThread(page, target) on a thread whose content failed to render, a deleted/expired thread, or parsers returning nothing due to a Gmail UI change; capture wait exhausted and renderedThread also empty.

Common situations: Accessing threads deleted from trash/spam since the search; very old threads that fail to lazy-load; Google DOM changes breaking message parsing.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/41167c537275d07f. Report an issue: GitHub.