{"record":{"id":"3ba3c1b42e24d38d","repo":"jackwener/OpenCLI","slug":"github-trending-request-failed-error-message","errorCode":null,"errorMessage":"github-trending request failed: ${error?.message || error}","messagePattern":"github-trending request failed: (.+?)","errorType":"error_code","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/github-trending/repos.js","lineNumber":143,"sourceCode":"            throw new ArgumentError('--limit must be <= 25 (GitHub Trending lists at most 25 repositories)');\n        }\n        const limit = n;\n\n        const language = String(args.language ?? '').trim();\n        const path = language ? `/trending/${encodeURIComponent(language)}` : '/trending';\n        const url = new URL(`https://github.com${path}`);\n        url.searchParams.set('since', since);\n\n        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,","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/github-trending/repos.js#L125-L161","documentation":"The HTTP request that fetches the GitHub Trending page threw (network-level failure before a response status was available), so the command wraps it in a CommandExecutionError prefixed 'github-trending request failed:' with the underlying error message. This is distinct from the HTTP-status failure variant ('HTTP <status>') — here the request itself failed to complete.","triggerScenarios":"fetch to https://github.com/trending... rejects — DNS resolution failure, connection refused/timeout, TLS errors, proxy misconfiguration, or the fetch call throwing for any reason inside the try block.","commonSituations":"No internet access or offline environment; corporate proxy/firewall blocking github.com; DNS issues in containers/CI; transient GitHub connectivity problems; TLS interception certificates not trusted by Node.","solutions":["Check network connectivity to github.com (curl https://github.com/trending)","Configure proxy environment variables (HTTPS_PROXY/HTTP_PROXY) if behind a proxy","Retry after a short wait — transient DNS/connection failures often resolve","If TLS interception is the cause, trust the corporate CA or set NODE_EXTRA_CA_CERTS"],"exampleFix":"// before\nconst html = await fetchTrending();\n// after: retry transient failures\nlet html;\nfor (let i = 0; i < 3 && !html; i++) {\n  try { html = await fetchTrending(); } catch (e) { await new Promise(r => setTimeout(r, 1000 * (i + 1))); }\n}","handlingStrategy":"retry","validationCode":"const reachable = await fetch('https://github.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!reachable) throw new Error('github.com unreachable — check network/proxy');","typeGuard":"function isRequestFailure(e) { return e instanceof Error && e.message.startsWith('github-trending request failed'); }","tryCatchPattern":"try {\n  await run(['opencli', 'github-trending', 'repos']);\n} catch (e) {\n  if (/request failed/.test(e.message) && attempt < 3) return retryWithBackoff(attempt + 1);\n  throw e;\n}","preventionTips":["Configure HTTPS_PROXY correctly in CI/corporate environments","Add retry with backoff around the command for transient network failures","Pre-check connectivity to github.com in scripts before scraping runs"],"tags":["network","github","http-request","cli"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}