jackwener/OpenCLI · warning · CliError

NOT_FOUND

NOT_FOUND

Error message

No Bloomberg Businessweek stories found

What it means

Thrown when the Businessweek page parsed successfully but produced a non-array or empty stories list. The library treats 'no stories extracted' as NOT_FOUND rather than a parse failure, since the page may legitimately have no stories accessible. Usually indicates the expected story nodes were missing from the fetched page.

Source

Thrown at clis/bloomberg/businessweek.js:114

      const stories = extractBusinessweekStoriesFromNextData(data);
      if (!stories) return { ok: false, error: 'NO_MODULES' };
      return { ok: true, stories };
    })()`);
        let result = await loadStories();
        // Next.js sometimes hydrates slowly — retry once before giving up.
        if (result && result.ok === false && (result.error === 'NO_NEXT_DATA' || result.error === 'NO_MODULES')) {
            await page.wait(4);
            result = await loadStories();
        }
        if (!result || typeof result !== 'object') {
            throw new CliError('PARSE_ERROR', 'Bloomberg Businessweek page returned malformed story data', 'Bloomberg may have changed the page structure.');
        }
        if (result.ok === false) {
            throw new CliError('PARSE_ERROR', `Bloomberg Businessweek page did not expose story data (${result.error})`, 'Bloomberg may have changed the page structure.');
        }
        const stories = Array.isArray(result.stories) ? result.stories : [];
        if (!stories.length) {
            throw new CliError('NOT_FOUND', 'No Bloomberg Businessweek stories found', 'Bloomberg may have changed the page structure.');
        }
        return stories.slice(0, count);
    },
});

export const __test__ = {
    command,
    parseBusinessweekLimit,
    normalizeBusinessweekStoryPath,
    extractBusinessweekStoriesFromNextData,
};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command — the page may not have hydrated on the first load
  2. Verify in a browser that bloomberg.com/businessweek currently lists stories
  3. Check that no consent-wall or region redirect is intercepting the page
  4. Update the library to a version compatible with the current page markup

Example fix

// before
const stories = await bw.getStories(20);
// after
let stories = [];
for (let i = 0; i < 3 && !stories.length; i++) {
  await new Promise(r => setTimeout(r, 1000 * i));
  stories = await bw.getStories(20);
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

function hasStories(r) {
  return r && Array.isArray(r.stories) && r.stories.length > 0;
}

Try / catch

try {
  const stories = await bw.getStories();
} catch (e) {
  if (e.code === 'NOT_FOUND') {
    // back off and retry; verify page in browser if it persists
  }
}

Prevention

When it happens

Trigger: Calling the Businessweek stories command when result.stories is absent or an empty array — e.g. page rendered an empty shell, all stories are paywalled/hidden, or the selector for story items no longer matches.

Common situations: Hitting the page before its data hydrates; Bloomberg serving a consent/region interstitial; requesting a count larger than available stories; page redesign removing the story list.

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/d03a6a5358f495e4. Report an issue: GitHub.