jackwener/OpenCLI · error · CommandExecutionError

1point3acres request failed: HTTP ${res.status} ${res.status

Error message

1point3acres request failed: HTTP ${res.status} ${res.statusText} from ${url}

What it means

fetchHtml performs an HTTP GET (with redirect: 'follow') against a 1point3acres.com URL. If the response arrives but res.ok is false (any non-2xx status), it wraps the status line and URL into a CommandExecutionError so the caller knows the remote site rejected the request. Network-level failures (no response) are caught earlier and rethrown with a different message.

Source

Thrown at clis/1point3acres/utils.js:60

/** Fetch a GBK-encoded Discuz page and return decoded UTF-8 HTML. */
export async function fetchHtml(url, { headers = {}, cookie = '' } = {}) {
    let res;
    try {
        res = await fetch(url, {
            headers: {
                'User-Agent': UA,
                'Accept': 'text/html,application/xhtml+xml',
                'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
                ...(cookie ? { Cookie: cookie } : {}),
                ...headers,
            },
            redirect: 'follow',
        });
    } catch (error) {
        throw new CommandExecutionError(`1point3acres request failed: ${error?.message || error}`);
    }
    if (!res.ok) {
        throw new CommandExecutionError(`1point3acres request failed: HTTP ${res.status} ${res.statusText} from ${url}`);
    }
    const buf = await res.arrayBuffer();
    return new TextDecoder('gbk').decode(buf);
}

/** Pull cookie string from the live browser session for this domain.
 *  Discuz auth cookies (4Oaf_61d6_*, session) are HttpOnly and set on the
 *  root domain `.1point3acres.com`, so we need `getCookies` (not document.cookie)
 *  AND we need to query both host + root domain and merge.
 */
export async function getCookie(page) {
    if (!page) return '';
    const seen = new Map();
    if (typeof page.getCookies === 'function') {
        for (const opts of [{ domain: 'www.1point3acres.com' }, { domain: '.1point3acres.com' }]) {
            try {
                const cookies = await page.getCookies(opts);
                for (const c of cookies || []) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry the command after a delay; the failure is often transient (429/5xx).
  2. Check the status code embedded in the message: 403/429 means anti-bot blocking — slow down or change headers; 404 means the thread/URL no longer exists.
  3. Verify the URL is a valid www.1point3acres.com page by opening it in a browser.
  4. Log in via the browser session if the resource requires authentication, since guest access may be rejected.

Example fix

// before
const html = await fetchHtml(url); // throws on 403/404/5xx
// after
let html;
try {
    html = await fetchHtml(url);
} catch (e) {
    if (/HTTP 429/.test(e.message)) await sleep(60_000); // back off on rate limit
    else throw e;
    html = await fetchHtml(url);
}
Defensive patterns

Strategy: retry

Validate before calling

// preflight: check reachability
const head = await fetch(url, { method: 'HEAD' });
if (!head.ok) throw new Error(`Skipping: ${url} returned ${head.status}`);

Type guard

function isOkResponse(res) {
    return res && typeof res.status === 'number' && res.status >= 200 && res.status < 300;
}

Try / catch

try {
    const html = await fetchHtml(url);
} catch (e) {
    if (/HTTP 429|HTTP 5\d\d/.test(e.message)) {
        await new Promise(r => setTimeout(r, 60_000)); // back off and retry
    } else {
        console.error(`1point3acres fetch failed: ${e.message}`);
    }
}

Prevention

When it happens

Trigger: Calling any 1point3acres-backed command whose fetchHtml request returns HTTP 4xx/5xx: e.g. the site returns 403 for blocked/scraping clients, 404 for a deleted thread, 429 for rate limiting, or 5xx during site outages.

Common situations: Site rate-limits or blocks the default User-Agent (403); requesting a deleted/moved thread (404); heavy scraping bursts triggering anti-bot protection; transient 1point3acres server errors; GBK-decoded pages being fetched during maintenance windows.

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


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