jackwener/OpenCLI · critical · CommandExecutionError

${label} request failed: ${err?.message ?? err}

Error message

${label} request failed: ${err?.message ?? err}

What it means

flathubFetch wraps the fetch() call to flathub.org; when the network request itself rejects (DNS failure, connection refused/reset, TLS error, timeout), it throws CommandExecutionError '<label> request failed: <underlying message>'. The library wraps rather than propagating the raw fetch error so callers get a consistent, labelled command failure.

Source

Thrown at clis/flathub/utils.js:57

        throw new ArgumentError(
            `flathub appId "${value}" is not a valid AppStream identifier`,
            'AppStream IDs use reverse-DNS like "org.mozilla.firefox" — letters/digits/`._-` with at least one dot.',
        );
    }
    return raw;
}

export async function flathubFetch(url, label, init) {
    let resp;
    try {
        resp = await fetch(url, {
            method: init?.method ?? 'GET',
            headers: { 'user-agent': UA, accept: 'application/json', ...(init?.headers ?? {}) },
            body: init?.body,
        });
    }
    catch (err) {
        throw new CommandExecutionError(
            `${label} request failed: ${err?.message ?? err}`,
            'Check that flathub.org is reachable from this network.',
        );
    }
    if (resp.status === 404) {
        throw new EmptyResultError(label, `Flathub returned 404 for ${url}.`);
    }
    if (resp.status === 429) {
        throw new CommandExecutionError(`${label} returned HTTP 429 (rate limited)`);
    }
    if (!resp.ok) {
        throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
    }
    let body;
    try {
        body = await resp.json();
    }
    catch (err) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and that https://flathub.org is reachable (curl -I https://flathub.org)
  2. Retry after a short wait — the failure is often transient
  3. Check proxy/firewall/VPN settings and DNS resolution (nslookup flathub.org)
  4. Inspect the underlying message in the error text to identify DNS vs TLS vs timeout and fix accordingly

Example fix

// before
await appInfo('org.mozilla.firefox'); // fails offline with no handling
// after
try {
  await appInfo('org.mozilla.firefox');
} catch (err) {
  if (/request failed/.test(err.message)) {
    console.error('flathub.org unreachable — check your network/proxy');
  } else throw err;
}
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight reachability check (optional)
const ok = await fetch('https://flathub.org/api/v2/search', { method: 'HEAD' })
  .then(() => true)
  .catch(() => false);
if (!ok) throw new Error('flathub.org is unreachable from this network');

Type guard

null

Try / catch

async function fetchWithRetry(fn, attempts = 3) {
  for (let i = 0; i < attempts; i++) {
    try { return await fn(); }
    catch (err) {
      const transient = err instanceof CommandExecutionError && /request failed/.test(err.message);
      if (!transient || i === attempts - 1) throw err;
      await new Promise((r) => setTimeout(r, 2 ** i * 500));
    }
  }
}

Prevention

When it happens

Trigger: Any adapter call while flathub.org is unreachable: no network connection, DNS resolution failure, offline machine, VPN/firewall/proxy blocking flathub.org, TLS interception, or Node fetch aborting on timeout.

Common situations: Working offline or on a captive-portal Wi-Fi; corporate proxy blocking the domain; DNS misconfiguration (/etc/resolv.conf, VPN split tunneling); transient flathub.org outage; IPv6-only breakage.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/2936ff5d38fa44cc. Report an issue: GitHub.