{"record":{"id":"a1cef845e789cc7e","repo":"jackwener/OpenCLI","slug":"gmail-operation-capture-lost-a-response-body-r","errorCode":null,"errorMessage":"Gmail ${operation} capture lost a response body; refusing possibly partial results","messagePattern":"Gmail (.+?) capture lost a response body; refusing possibly partial results","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/gmail/utils.js","lineNumber":346,"sourceCode":"        typeof entry?.responsePreview !== 'string'\n        && entry?.responseBodyTruncated !== true\n      ))) {\n        bodylessCaptureObserved = true;\n      }\n      matches.push(...settledEndpointEntries.filter((entry) => (\n        typeof entry?.responsePreview === 'string' || entry?.responseBodyTruncated === true\n      )));\n      if (bodylessCaptureObserved) {\n        throw new CommandExecutionError(\n          `Gmail ${operation} capture included a response without a body; refusing possibly partial results`,\n        );\n      }\n      return matches.map((entry) => parseJsonCapture(entry, operation));\n    }\n    await page.sleep(0.25);\n  }\n  if (bodylessCaptureObserved) {\n    throw new CommandExecutionError(\n      `Gmail ${operation} capture lost a response body; refusing possibly partial results`,\n    );\n  }\n  throw new TimeoutError(`Gmail ${operation} capture`, timeoutSeconds, `No /${endpoint} response was observed after the Gmail action.`);\n}\n\nasync function renderedLabels(page, account) {\n  await page.goto(`${GMAIL_ORIGIN}/mail/u/${account}/#settings/labels`);\n  await page.sleep(2);\n  const rows = unwrapBrowserResult(await page.evaluate(`() => {\n    const routes = new RegExp('^(?:#(?:inbox|starred|snoozed|sent|drafts|important|spam|trash)|#label/)');\n    const systemNames = {\n      inbox: 'Inbox', starred: 'Starred', snoozed: 'Snoozed', sent: 'Sent',\n      drafts: 'Drafts', important: 'Important', spam: 'Spam', trash: 'Trash',\n      scheduled: 'Scheduled', all: 'All Mail',\n      'category/purchases': 'Purchases', 'category/social': 'Social',\n      'category/updates': 'Updates', 'category/forums': 'Forums',\n      'category/promotions': 'Promotions',","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gmail/utils.js#L328-L364","documentation":"waitGmailCaptures throws this CommandExecutionError when the capture window closed with at least one bodyless response observed but no usable matches — a response was seen during the wait, then its body was never recoverable. Like its sibling error, it protects against returning partial Gmail results.","triggerScenarios":"The polling loop in waitGmailCaptures ends (deadline reached) with bodylessCaptureObserved === true and matches still empty for the /{endpoint} capture, after a Gmail action such as a search submission.","commonSituations":"Response headers arrived but the body read failed before the capture buffer was read; network dropped mid-response; the driver's capture buffer was overwritten; Gmail reloaded mid-operation invalidating captured entries.","solutions":["Retry the operation on a stable connection","Check network reliability/proxy stability between browser and Gmail","Update the browser automation driver to one that retains captured response bodies for the full capture window","Reload Gmail before retrying to clear stale capture state"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const results = await queryThreads(page, 'label:important');\n} catch (e) {\n  if (/capture lost a response body/.test(e.message)) {\n    await page.reload();\n    return queryThreads(page, 'label:important');\n  }\n  throw e;\n}","preventionTips":["Run on a stable network/proxy so response bodies complete","Reload Gmail before retrying to clear stale capture state","Update the driver if body reads routinely fail mid-capture"],"tags":["network-capture","gmail","partial-data","timeout"],"backgroundTag":"empty-response-body","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}