{"record":{"id":"4d1ad759e52230c4","repo":"jackwener/OpenCLI","slug":"no-trending-repositories-for-language-language","errorCode":null,"errorMessage":"no trending repositories for language \"${language}\" (${since})","messagePattern":"no trending repositories for language \"(.+?)\" \\((.+?)\\)","errorType":"error_code","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/github-trending/repos.js","lineNumber":152,"sourceCode":"        let resp;\n        try {\n            resp = await fetch(url, {\n                headers: {\n                    'User-Agent': 'Mozilla/5.0 (compatible; opencli/github-trending)',\n                    Accept: 'text/html',\n                },\n            });\n        } catch (error) {\n            throw new CommandExecutionError(`github-trending request failed: ${error?.message || error}`);\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`github-trending request failed: HTTP ${resp.status}`);\n        }\n\n        const html = await resp.text();\n        const rows = parseTrendingHtml(html, limit);\n        if (rows.length === 0) {\n            throw new EmptyResultError('github-trending', language\n                ? `no trending repositories for language \"${language}\" (${since})`\n                : `no trending repositories (${since})`);\n        }\n\n        return rows.map((row, index) => ({\n            rank: index + 1,\n            repo: row.repo,\n            description: row.description,\n            language: row.language,\n            stars: row.stars,\n            forks: row.forks,\n            starsSince: row.starsSince,\n            url: row.url,\n        }));\n    },\n});\n","sourceCodeStart":134,"sourceCodeEnd":169,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/github-trending/repos.js#L134-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry with a broader since window (weekly/monthly) or without a language filter to confirm data exists","Verify manually in a browser that the same trending URL shows repositories","Re-run later — trending lists refresh periodically and can be temporarily sparse","If the page clearly has repos, update parseTrendingHtml selectors to match the current GitHub markup","Catch EmptyResultError and fall back to a GitHub Search API query sorted by stars"],"exampleFix":"// before\nconst rows = await runGithubTrending({ language: 'cobol', since: 'daily' });\n// after\nlet rows;\ntry {\n  rows = await runGithubTrending({ language: 'cobol', since: 'daily' });\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    rows = await runGithubTrending({ language: 'cobol', since: 'weekly' });\n  } else throw e;\n}","handlingStrategy":"fallback","validationCode":"const html = await (await fetch(trendingUrl)).text();\nif (!/repo-list|Box-row|trending/.test(html)) {\n  console.warn('trending page may be empty or markup changed');\n}","typeGuard":"function hasRows(rows) {\n  return Array.isArray(rows) && rows.length > 0;\n}","tryCatchPattern":"try {\n  rows = await runGithubTrending(opts);\n} catch (e) {\n  if (e.name === 'EmptyResultError') rows = await runGithubTrending({ ...opts, since: 'weekly' });\n  else throw e;\n}","preventionTips":["Prefer broader `since` windows for niche languages","Add a fallback to GitHub Search API sorted by stars","Alert on empty parses — it may indicate a GitHub markup change","Pin/parser-test against the live page after GitHub UI updates","Treat empty result as data, not always an exception"],"tags":["empty-result","scraping","github","parser"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}