jackwener/OpenCLI · error · Error
Request failed: ${result?.status} ${result?.statusText} (${r
Error message
Request failed: ${result?.status} ${result?.statusText} (${result?.url || url}) What it means
Thrown by fetchJsonInBrowser when the fetch executed inside the Playwright/Puppeteer page returns a non-ok HTTP response. The error includes the status, statusText, and the requested URL, so it surfaces any 404/500/blocked request made against uiverse.io route-data or code-resource endpoints.
Source
Thrown at clis/uiverse/_shared.js:70
const response = await fetch(url, {
credentials: 'include',
headers: {
accept: 'application/json, text/plain, */*',
},
});
const text = await response.text();
return JSON.stringify({
ok: response.ok,
status: response.status,
statusText: response.statusText,
text,
url,
});
})()`);
const result = JSON.parse(raw);
if (!result?.ok) {
throw new Error(`Request failed: ${result?.status} ${result?.statusText} (${result?.url || url})`);
}
try {
return JSON.parse(result.text);
} catch {
throw new Error(`Response was not valid JSON: ${url}`);
}
}
export async function getPostDetails(page, input) {
const normalized = parseComponentInput(input);
await page.goto(normalized.url);
const raw = await page.evaluate(`(async () => {
const key = ${JSON.stringify(ROUTE_DATA_KEY)};
const loaderData = window.__remixContext?.state?.loaderData || {};
const routeData = loaderData[key];
return JSON.stringify({ routeData: routeData || null, keys: Object.keys(loaderData) });View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the author/slug is valid by opening the component URL in a browser
- Retry after a delay with backoff — 429/5xx are often transient rate limits or deploys
- Run the browser headed and check for Cloudflare/bot-protection interstitials; solve the challenge or use a residential/stealth setup
- Log in within the browser page if the resource requires authentication (cookies are sent via credentials:'include')
Example fix
// before
const details = await getPostDetails(page, input); // 404 for typo slug
// after
try {
const details = await getPostDetails(page, input);
} catch (e) {
if (e.message.includes('404')) throw new Error(`Component not found: ${input}`);
await new Promise(r => setTimeout(r, 5000)); // retry on 429/5xx
const details = await getPostDetails(page, input);
} Defensive patterns
Strategy: retry
Validate before calling
// Cannot fully pre-validate server state, but verify the component exists in a browser first:
await page.goto(`https://uiverse.io/${author}/${slug}`);
const notFound = await page.locator('text=Page Not Found').count();
if (notFound) throw new Error(`Component ${author}/${slug} does not exist`); Type guard
const isFailedStatus = (status) => status === 0 || status === 403 || status === 404 || status === 429 || status >= 500;
Try / catch
try {
const payload = await getRawCode(page, postId);
} catch (e) {
if (e.message.startsWith('Request failed')) {
if (/(429|5\d\d)/.test(e.message)) {
await sleep(5000); // retry transient failures with backoff
return getRawCode(page, postId);
}
if (e.message.includes('404')) throw new Error(`Resource not found: ${e.message}`);
}
throw e;
} Prevention
- Verify author/slug by opening the page in a real browser before batch scraping
- Throttle requests (delay between calls) to avoid 429 rate limits
- Keep a logged-in browser session for authenticated resources
- Run headed or with stealth plugins if bot protection returns 403
When it happens
Trigger: getPostDetails falling back to the ?_data=routes/$username.$friendlyId endpoint for a component that does not exist (404); getRawCode hitting /resource/post/code/<postId> with a stale or invalid postId; uiverse.io returning 5xx or a 403 from rate limiting / bot protection (Cloudflare challenge); expired session cookies when credentials:'include' no longer authenticates.
Common situations: Typo in author/slug leading to a nonexistent page whose loader endpoint 404s; scraping while uiverse.io deploys and its Remix data endpoints change; heavy scraping triggering WAF blocks; network/proxy outage producing 502/503.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- 1point3acres request failed: HTTP ${res.status} ${res.status
- Barchart greeks request failed: HTTP ${data.status}${data.st
- github-trending request failed: HTTP ${resp.status}
- HTTP ${code}
- Sina blog search failed: HTTP ${resp.status}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e188fc6f6dc4b3a8.
Report an issue: GitHub.