{"record":{"id":"0846e62ea250e874","repo":"jackwener/OpenCLI","slug":"youtube-history-request","errorCode":null,"errorMessage":"YouTube history request","messagePattern":"YouTube history request","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/youtube/history.js","lineNumber":262,"sourceCode":"            return { error: 'repeated-cursor', message: 'YouTube history repeated a continuation cursor' };\n          }\n          seenCursors.add(nextCursor);\n          requestBody = { continuation: nextCursor };\n        }\n\n        return {\n          error: 'page-cap',\n          message: 'YouTube history pagination stopped before satisfying the requested limit',\n        };\n      })()\n    `);\n\n        if (Array.isArray(result)) return result;\n        if (result?.error === 'auth') {\n            throw new AuthRequiredError('www.youtube.com', result.message || 'Not logged in to YouTube');\n        }\n        if (result?.error === 'timeout') {\n            throw new TimeoutError('YouTube history request', REQUEST_TIMEOUT_SECONDS);\n        }\n        if (result?.error === 'empty') {\n            throw new EmptyResultError('youtube history', result.message || 'No watch history items found');\n        }\n        throw new CommandExecutionError(result?.message || 'Failed to fetch YouTube history');\n    },\n});\n","sourceCodeStart":244,"sourceCodeEnd":270,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/youtube/history.js#L244-L270","documentation":"TimeoutError thrown by `youtube history` when the in-page request exceeds REQUEST_TIMEOUT_SECONDS (15s). The script guards each InnerTube request with a timeout and reports error === 'timeout', which the host converts to TimeoutError('YouTube history request', 15). It means YouTube did not respond in time, not that data was missing.","triggerScenarios":"FEhistory API call taking >15s — slow network/proxy, YouTube throttling or serving slowly under rate limiting, heavy pagination across up to 20 pages, or the browser tab being backgrounded/throttled.","commonSituations":"Running many history scrapes back-to-back and getting rate-limited; weak connection or high-latency VPN; headless browser CPU throttling; YouTube incident causing slow API responses.","solutions":["Wait and retry — transient slowness or soft rate-limiting usually clears.","Reduce the limit so fewer pages are fetched per run.","Check network/proxy latency to youtube.com; disable throttling VPN if used.","Space out scrapes (backoff) to avoid YouTube throttling."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function withRetry(fn, tries = 3) {\n  for (let i = 0; i < tries; i++) {\n    try { return await fn(); }\n    catch (e) {\n      if (e instanceof TimeoutError && i < tries - 1) {\n        await sleep(2000 * (i + 1));\n        continue;\n      }\n      throw e;\n    }\n  }\n}\nconst history = await withRetry(() => yt.history({ limit: 30 }));","preventionTips":["Retry with exponential backoff — timeouts are often transient throttling.","Lower the limit to reduce pages fetched per run.","Scrape during off-peak hours and space out runs.","Avoid heavily throttled networks/background tabs that slow the page."],"tags":["timeout","youtube","network","rate-limiting"],"backgroundTag":"request-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}