jackwener/OpenCLI · error · CommandExecutionError
lobsters domain request failed: ${err?.message ?? err}
Error message
lobsters domain request failed: ${err?.message ?? err} What it means
Thrown when the fetch() call to https://lobste.rs/domains/<domain>.json itself fails (network-level error: DNS failure, connection refused, TLS error, timeout). The original error's message is wrapped into a CommandExecutionError with the hint 'Check that lobste.rs is reachable from this network.' HTTP error statuses (e.g. 404, 5xx) are handled separately and do NOT produce this error.
Source
Thrown at clis/lobsters/domain.js:57
description: 'Lobste.rs stories submitted from a specific domain',
domain: 'lobste.rs',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'domain', positional: true, required: true, help: 'Source domain (e.g. github.com, arxiv.org, blog.cloudflare.com)' },
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories (1-25 — single page)' },
],
columns: ['rank', 'id', 'title', 'score', 'author', 'comments', 'created_at', 'tags', 'submission_url', 'comments_url'],
func: async (args) => {
const domain = requireDomain(args.domain);
const limit = requireBoundedInt(args.limit, 20, 25);
const url = `https://lobste.rs/domains/${encodeURIComponent(domain)}.json`;
let resp;
try {
resp = await fetch(url, { headers: { 'user-agent': 'opencli-lobsters-adapter (+https://github.com/jackwener/opencli)' } });
}
catch (err) {
throw new CommandExecutionError(
`lobsters domain request failed: ${err?.message ?? err}`,
'Check that lobste.rs is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError('lobsters domain', `No Lobste.rs stories found for domain "${domain}".`);
}
if (!resp.ok) {
throw new CommandExecutionError(`lobsters domain returned HTTP ${resp.status}`);
}
let body;
try {
body = await resp.json();
}
catch (err) {
throw new CommandExecutionError(`lobsters domain returned malformed JSON: ${err?.message ?? err}`);
}
const list = Array.isArray(body) ? body : [];View on GitHub (pinned to 49907e53dc)
Solutions
- Verify network connectivity (curl https://lobste.rs/domains/github.com.json) and check whether lobste.rs is reachable from the machine
- Check proxy env vars (HTTPS_PROXY/HTTP_PROXY) and that the runtime honors them; configure a proxy if behind a firewall
- Inspect the inner message (err?.message) for DNS vs TLS vs timeout specifics and fix accordingly (e.g. VPN on, DNS server changed)
- Add retry with backoff for transient outages, or fetch from an alternate network/VPN
Example fix
// before
const stories = await cli.domain('github.com'); // throws offline
// after
try {
const stories = await cli.domain('github.com');
} catch (err) {
if (err instanceof CommandExecutionError && /request failed/.test(err.message)) {
await retry(() => cli.domain('github.com'), { attempts: 3, backoff: 'exponential' });
} else throw err;
} Defensive patterns
Strategy: retry
Validate before calling
// Optional pre-flight reachability probe
async function isLobstersReachable(timeoutMs = 5000) {
try {
const c = new AbortController();
const t = setTimeout(() => c.abort(), timeoutMs);
await fetch('https://lobste.rs/', { signal: c.signal });
clearTimeout(t);
return true;
} catch { return false;
}
} Type guard
function isNetworkFailure(err) {
return err instanceof CommandExecutionError && err.message.includes('lobsters domain request failed');
} Try / catch
try {
const stories = await cli.domain(domain);
} catch (err) {
if (isNetworkFailure(err)) {
console.error('Cannot reach lobste.rs:', err.message, '- check connectivity/proxy');
// retry with backoff for transient failures
} else throw err;
} Prevention
- Probe connectivity or serve from cache when lobste.rs is unreachable
- Configure HTTPS_PROXY in CI/containers that route through a corporate proxy
- Add exponential-backoff retries for transient network errors
- Monitor lobste.rs status and surface the inner error message for diagnosis (DNS vs TLS vs timeout)
When it happens
Trigger: fetch() rejects: DNS resolution failure for lobste.rs, no internet/VPN required, firewall or proxy blocking the request, TLS interception, or process offline.
Common situations: Running the CLI in a CI container or air-gapped network without egress; corporate proxy not configured (HTTPS_PROXY); DNS blocked by a network filter; laptop offline; lobste.rs temporarily down or blocked by a DNS sinkhole.
Related errors
- `${label} request failed: ${err?.message ?? err}`
- Failed to fetch Flomo memos: ${err instanceof Error ? err.me
- ${label} request failed: ${err?.message ?? err}
- FETCH_ERROR
- ${label} request failed: ${err?.message ?? err}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/797a9ed8446589dc.
Report an issue: GitHub.