jackwener/OpenCLI · warning · EmptyResultError

no trending repositories for language "${language}" (${since

Error message

no trending repositories for language "${language}" (${since})

What it means

After a successful HTTP fetch, the CLI parses the trending HTML with parseTrendingHtml and throws EmptyResultError when zero repository rows are extracted. This signals the page rendered no trending list for the requested language/time window — either GitHub genuinely has no entries or the HTML structure changed and parsing silently matched nothing.

Source

Thrown at clis/github-trending/repos.js:152

        let resp;
        try {
            resp = await fetch(url, {
                headers: {
                    'User-Agent': 'Mozilla/5.0 (compatible; opencli/github-trending)',
                    Accept: 'text/html',
                },
            });
        } catch (error) {
            throw new CommandExecutionError(`github-trending request failed: ${error?.message || error}`);
        }
        if (!resp.ok) {
            throw new CommandExecutionError(`github-trending request failed: HTTP ${resp.status}`);
        }

        const html = await resp.text();
        const rows = parseTrendingHtml(html, limit);
        if (rows.length === 0) {
            throw new EmptyResultError('github-trending', language
                ? `no trending repositories for language "${language}" (${since})`
                : `no trending repositories (${since})`);
        }

        return rows.map((row, index) => ({
            rank: index + 1,
            repo: row.repo,
            description: row.description,
            language: row.language,
            stars: row.stars,
            forks: row.forks,
            starsSince: row.starsSince,
            url: row.url,
        }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a broader since window (weekly/monthly) or without a language filter to confirm data exists
  2. Verify manually in a browser that the same trending URL shows repositories
  3. Re-run later — trending lists refresh periodically and can be temporarily sparse
  4. If the page clearly has repos, update parseTrendingHtml selectors to match the current GitHub markup
  5. Catch EmptyResultError and fall back to a GitHub Search API query sorted by stars

Example fix

// before
const rows = await runGithubTrending({ language: 'cobol', since: 'daily' });
// after
let rows;
try {
  rows = await runGithubTrending({ language: 'cobol', since: 'daily' });
} catch (e) {
  if (e instanceof EmptyResultError) {
    rows = await runGithubTrending({ language: 'cobol', since: 'weekly' });
  } else throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

const html = await (await fetch(trendingUrl)).text();
if (!/repo-list|Box-row|trending/.test(html)) {
  console.warn('trending page may be empty or markup changed');
}

Type guard

function hasRows(rows) {
  return Array.isArray(rows) && rows.length > 0;
}

Try / catch

try {
  rows = await runGithubTrending(opts);
} catch (e) {
  if (e.name === 'EmptyResultError') rows = await runGithubTrending({ ...opts, since: 'weekly' });
  else throw e;
}

Prevention

When it happens

Trigger: parseTrendingHtml(html, limit) returns an empty array for the fetched https://github.com/trending[/<language>?since=<since>] page, with a language filter supplied (message includes the language) or without one.

Common situations: Very new/rare language slugs where trending is empty for the chosen `since` window; GitHub redesigns the trending page markup so the parser's selectors no longer match; regional/experimental pages returning near-empty content; extremely short since windows (daily) for niche languages.

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