jackwener/OpenCLI · error · CommandExecutionError

${label} returned HTTP ${resp.status}

Error message

${label} returned HTTP ${resp.status}

What it means

flathubFetch throws CommandExecutionError '<label> returned HTTP <status>' for any non-OK response that is not specifically 404 or 429 (e.g. 500, 502, 503, 403). It signals an unexpected server-side or access problem with the Flathub API, with the status code embedded for diagnosis.

Source

Thrown at clis/flathub/utils.js:69

            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) {
        throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);
    }
    return body;
}

export function joinList(value, max = 10) {
    if (!Array.isArray(value)) return '';
    const items = value.filter((v) => typeof v === 'string' && v.trim());
    if (items.length === 0) return '';
    if (items.length > max) return [...items.slice(0, max), `(+${items.length - max})`].join(', ');
    return items.join(', ');
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check https://status.flathub.org or try the URL in a browser to see if Flathub is down
  2. Retry with backoff — 5xx errors are often transient
  3. Check for 403-specific causes: proxy/VPN IP blocked, or custom user-agent rejected — try from another network
  4. If persistent, report/inspect the failing URL and status; adjust requests to match the current v2 API

Example fix

// before
const info = await appInfo(id); // crashes on transient 502
// after
let info;
for (let attempt = 0; attempt < 3; attempt++) {
  try { info = await appInfo(id); break; }
  catch (err) {
    if (!/HTTP 5\d\d/.test(err.message) || attempt === 2) throw err;
    await new Promise((r) => setTimeout(r, 2 ** attempt * 500));
  }
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  const info = await appInfo(appId);
} catch (err) {
  const m = err.message.match(/HTTP (\d{3})/);
  if (m && Number(m[1]) >= 500) {
    console.error('Flathub server error — retry later or check status.flathub.org');
  } else throw err;
}

Prevention

When it happens

Trigger: Flathub returning 5xx during an outage or maintenance; 403 from a WAF/CDN blocking the client's IP or user-agent; gateway errors (502/504) from Cloudflare in front of flathub.org; unexpected API-side errors on a valid request.

Common situations: Calling the API during a Flathub outage or deploy; corporate proxies/CDN rules rejecting requests; shared-IP blocking; brief upstream instability causing intermittent 5xx.

Related errors


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