jackwener/OpenCLI · error · CommandExecutionError

1point3acres request failed: ${error?.message || error}

Error message

1point3acres request failed: ${error?.message || error}

What it means

CommandExecutionError from fetchHtml wrapping any network-level failure of the 1point3acres HTTP request — DNS failure, connection refused/timeout, TLS errors, or aborts. The underlying error's message is interpolated into '1point3acres request failed: <reason>'. Separately, non-2xx responses produce a sibling error with the HTTP status. The response body is decoded as GBK, matching the forum's encoding.

Source

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

const UA = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0 Safari/537.36';

/** 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' }]) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the wrapped message after '1point3acres request failed:' to identify the root cause (ENOTFOUND, ECONNREFUSED, ETIMEDOUT, cert error)
  2. Check basic connectivity: curl -I https://www.1point3acres.com/bbs/forum.php
  3. Retry with backoff — transient network errors and CDN hiccups are common
  4. Check HTTP(S)_PROXY / HTTPS_PROXY / NO_PROXY env vars if behind a corporate network or VPN
  5. If a specific HTTP status is reported instead (HTTP 403/503), it's an anti-bot block — slow down, add/refresh cookies, or use a session with login
  6. Verify DNS: nslookup www.1point3acres.com

Example fix

// before
const html = await fetchHtml(url);  // ENOTFOUND → CommandExecutionError
// after
import { CommandExecutionError } from './errors.js';
try {
  const html = await fetchHtml(url);
} catch (e) {
  if (e instanceof CommandExecutionError && /ECONN|ENOTFOUND|ETIMEDOUT/.test(e.message)) {
    await new Promise(r => setTimeout(r, 2000));
    const html = await fetchHtml(url);  // retry once
  } else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

import { CommandExecutionError } from 'clis/1point3acres/errors.js';
async function fetchWithRetry(url, attempts = 3) {
  for (let i = 0; i < attempts; i++) {
    try {
      return await fetchHtml(url);
    } catch (e) {
      const transient = e instanceof CommandExecutionError &&
        /ECONNRESET|ETIMEDOUT|ENOTFOUND|ECONNREFUSED|socket|network/i.test(e.message);
      if (transient && i < attempts - 1) {
        await new Promise(r => setTimeout(r, 1000 * 2 ** i));
        continue;
      }
      throw e;
    }
  }
}

Prevention

When it happens

Trigger: No network / DNS resolution failure for www.1point3acres.com; server or CDN down; connection timeout; ECONNRESET; request aborted; proxy misconfiguration (HTTP(S)_PROXY env pointing at a dead proxy); IPv6 connectivity issues.

Common situations: Corporate firewall or GFW blocking the site; running from a region where the forum is unreachable; transient CDN outages; container without outbound internet; wrong proxy env vars; expired DNS in long-running processes.

Related errors


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