{"record":{"id":"41167c537275d07f","repo":"jackwener/OpenCLI","slug":"gmail-thread","errorCode":"gmail thread","errorMessage":"No messages found for thread ${target}","messagePattern":"No messages found for thread (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/gmail/utils.js","lineNumber":606,"sourceCode":"    if (window.location.hash === target) window.location.hash = '#inbox';\n    setTimeout(() => { window.location.hash = target; }, 50);\n    return true;\n  }`), 'thread navigation');\n    if (navigated !== true) throw new CommandExecutionError('Gmail thread navigation failed');\n  }\n  let messages = [];\n  try {\n    const bodies = await waitGmailCaptures(page, 'fd', 'thread', 3);\n    messages = bodies.flatMap(parseFetchData);\n  } catch (error) {\n    if (!(error instanceof TimeoutError)) throw error;\n    await page.sleep(0.5);\n    messages = await renderedThread(page, target);\n    if (messages.length === 0) throw error;\n  }\n  const unique = [...new Map(messages.map((message) => [message.messageId, message])).values()];\n  if (unique.length === 0) {\n    throw new EmptyResultError('gmail thread', `No messages found for thread ${target}`);\n  }\n  return unique;\n}\n","sourceCodeStart":588,"sourceCodeEnd":610,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gmail/utils.js#L588-L610","documentation":"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.","triggerScenarios":"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.","commonSituations":"Accessing threads deleted from trash/spam since the search; very old threads that fail to lazy-load; Google DOM changes breaking message parsing.","solutions":["Re-run `gmail search` to confirm the thread still exists, then fetch again","Retry — thread content can be slow to load; the library already retries with renderedThread","Update the library if parsers no longer match Gmail's DOM","Verify the thread id (a wrong id can land on an empty view)"],"exampleFix":"// before\nconst msgs = await fetchThread(page, staleThreadId);\n// after\nconst fresh = await queryThreads(page, query); // re-resolve\nif (fresh.length) { const msgs = await fetchThread(page, fresh[0].threadId); }","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try { msgs = await fetchThread(page, id); }\ncatch (e) { if (e instanceof EmptyResultError && e.code === 'gmail thread') { await page.sleep(2); msgs = await fetchThread(page, id).catch(() => []); } else throw e; }","preventionTips":["Re-resolve thread ids via search before fetching old threads","Retry once — thread bodies lazy-load slowly","Confirm the thread exists and was not purged from trash/spam"],"tags":["empty-result","gmail","thread"],"backgroundTag":"empty-search-results","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}