jackwener/OpenCLI · warning · EmptyResultError

youtube history

Error message

youtube history

What it means

EmptyResultError thrown by `youtube history` when the in-page script reports error === 'empty' (or an explicit empty payload with a message). The scrape succeeded but zero watch-history items were found, which the library surfaces as an error because history being empty is usually unexpected.

Source

Thrown at clis/youtube/history.js:265

          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. Confirm watch history is enabled: YouTube → Settings → History & privacy → ensure 'Pause watch history' is off.
  2. Watch a video or two, then re-run to populate history.
  3. Check auto-delete settings that may have purged all items.
  4. If history is visibly non-empty on youtube.com but the command returns empty, report a possible extractor regression.
Defensive patterns

Strategy: fallback

Try / catch

try {
  return await yt.history({ limit });
} catch (e) {
  if (e instanceof EmptyResultError) {
    return []; // account genuinely has no watch history
  }
  throw e;
}

Prevention

When it happens

Trigger: YouTube account with watch history paused or cleared, a brand-new account with no watched videos, history disabled via 'Pause watch history', or the FEhistory payload returning no items despite a valid session.

Common situations: Users who turned off watch history for privacy; freshly created Google accounts; history auto-deleted (auto-delete set to 3 months and no recent activity); managed/child accounts with history disabled by policy.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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