jackwener/OpenCLI · error · CliError

FETCH_ERROR

FETCH_ERROR

Error message

Bloomberg served the bot-protection page instead of article content

What it means

Thrown when Bloomberg responds with its bot-protection (ROBOT_PAGE) interstitial instead of real article content. The library classifies it as FETCH_ERROR because the request never obtained the intended resource. It deliberately does not bypass the protection and relies on your existing browser session/access.

Source

Thrown at clis/bloomberg/news.js:85

          summary: story.summary || story.socialDescription || story.seoDescription || document.querySelector('meta[name="description"]')?.getAttribute('content') || '',
          url: story.url || story.readingUrl || location.href,
          body: story.body || null,
          lede: story.lede || null,
          ledeImageUrl: story.ledeImageUrl || null,
          socialImageUrl: story.socialImageUrl || null,
          imageAttachments: story.imageAttachments || {},
          videoAttachments: story.videoAttachments || {},
        }
      };
    })()`);
        let result = await loadStory();
        // Retry once — Bloomberg pages sometimes hydrate slowly.
        if (result?.errorCode === 'NO_NEXT_DATA' || result?.errorCode === 'NO_STORY') {
            await page.wait(4);
            result = await loadStory();
        }
        if (result?.errorCode === 'ROBOT_PAGE') {
            throw new CliError('FETCH_ERROR', 'Bloomberg served the bot-protection page instead of article content', 'Try again later or open the article in a regular Chrome session first, then rerun the command. This command uses your current Bloomberg access and does not bypass paywall or entitlement checks.');
        }
        if (result?.errorCode) {
            throw new CliError('PARSE_ERROR', `Bloomberg page did not expose article story data (${result.errorCode})`, 'This command currently works on standard Bloomberg story/article pages that expose __NEXT_DATA__. Audio, video, newsletter, or other non-standard/blocked pages may not work. Access still depends on your current Bloomberg session.');
        }
        const story = result?.story;
        if (!story) {
            throw new CliError('PARSE_ERROR', 'Failed to extract Bloomberg story data', 'Bloomberg may have changed the page structure.');
        }
        const content = renderStoryBody(story.body);
        if (!content) {
            throw new CliError('PARSE_ERROR', 'Bloomberg article body was empty after parsing', 'Bloomberg may have changed the story-body format, the URL may not point to a standard article page, or the page may not be accessible in your current Bloomberg session.');
        }
        return [{
                title: story.headline || '',
                summary: story.summary || '',
                link: story.url || url,
                mediaLinks: extractStoryMediaLinks(story),
                content,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the article URL in a regular Chrome session to clear the bot check, then rerun the command
  2. Wait and retry later — protections are often rate/time based
  3. Run the command from a residential IP rather than a datacenter/CI environment
  4. Reuse an authenticated browser profile/session that has passed the check

Example fix

// before
const story = await news.getArticle(url);
// after
try {
  const story = await news.getArticle(url);
} catch (e) {
  if (e.code === 'FETCH_ERROR' && /bot-protection/.test(e.message)) {
    // alert operator to open a browser session; retry with backoff
    await wait(60_000);
  }
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  const story = await news.getArticle(url);
} catch (e) {
  if (e.code === 'FETCH_ERROR' && /bot-protection/.test(e.message)) {
    await sleep(60_000); // exponential backoff before retry
  }
}

Prevention

When it happens

Trigger: Calling a Bloomberg news command whose headless page load detects automation — result.errorCode === 'ROBOT_PAGE' after the initial load and retry.

Common situations: Running from a datacenter IP or CI runner; cookies/session absent or expired; too many automated requests in a short window; missing Chrome profile the bot check expects.

Related errors


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