jackwener/OpenCLI · error · TimeoutError

YouTube history request

Error message

YouTube history request

What it means

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.

Source

Thrown at clis/youtube/history.js:262

            return { error: 'repeated-cursor', message: 'YouTube history repeated a continuation cursor' };
          }
          seenCursors.add(nextCursor);
          requestBody = { continuation: nextCursor };
        }

        return {
          error: 'page-cap',
          message: 'YouTube history pagination stopped before satisfying the requested limit',
        };
      })()
    `);

        if (Array.isArray(result)) return result;
        if (result?.error === 'auth') {
            throw new AuthRequiredError('www.youtube.com', result.message || 'Not logged in to YouTube');
        }
        if (result?.error === 'timeout') {
            throw new TimeoutError('YouTube history request', REQUEST_TIMEOUT_SECONDS);
        }
        if (result?.error === 'empty') {
            throw new EmptyResultError('youtube history', result.message || 'No watch history items found');
        }
        throw new CommandExecutionError(result?.message || 'Failed to fetch YouTube history');
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait and retry — transient slowness or soft rate-limiting usually clears.
  2. Reduce the limit so fewer pages are fetched per run.
  3. Check network/proxy latency to youtube.com; disable throttling VPN if used.
  4. Space out scrapes (backoff) to avoid YouTube throttling.
Defensive patterns

Strategy: retry

Try / catch

async function withRetry(fn, tries = 3) {
  for (let i = 0; i < tries; i++) {
    try { return await fn(); }
    catch (e) {
      if (e instanceof TimeoutError && i < tries - 1) {
        await sleep(2000 * (i + 1));
        continue;
      }
      throw e;
    }
  }
}
const history = await withRetry(() => yt.history({ limit: 30 }));

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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