jackwener/OpenCLI · error · CommandExecutionError

${label} request failed: ${outcome.detail}

Error message

${label} request failed: ${outcome.detail}

What it means

postJikeApi wraps HTTP calls to web.okjike.com's API. When the fetch fails at the transport level (network error, DNS failure, connection reset, TLS error) the outcome object has kind 'transport', and the helper throws a CommandExecutionError with the label and underlying detail instead of returning a body. This distinguishes network-level failure from HTTP error statuses or malformed JSON.

Source

Thrown at clis/jike/utils.js:79

        headers,
        body: JSON.stringify(${JSON.stringify(requestBody)}),
      });
      let body;
      try {
        body = await response.json();
      } catch (error) {
        return { kind: 'json', status: response.status, detail: String(error?.message || error) };
      }
      return { kind: 'response', status: response.status, body };
    } catch (error) {
      return { kind: 'transport', detail: String(error?.message || error) };
    }
  })()`);
  if (outcome?.kind === 'auth' || outcome?.status === 401 || outcome?.status === 403) {
    throw new AuthRequiredError('web.okjike.com', outcome?.detail || `${label} returned HTTP ${outcome?.status}`);
  }
  if (outcome?.kind === 'transport') {
    throw new CommandExecutionError(`${label} request failed: ${outcome.detail}`);
  }
  if (outcome?.kind === 'json') {
    throw new CommandExecutionError(`${label} returned invalid JSON: ${outcome.detail}`);
  }
  if (outcome?.kind !== 'response' || !Number.isInteger(outcome.status)) {
    throw new CommandExecutionError(`${label} returned an unexpected response`);
  }
  if (outcome.status < 200 || outcome.status >= 300) {
    throw new CommandExecutionError(`${label} returned HTTP ${outcome.status}`);
  }
  return outcome.body;
}

/**
 * 注入浏览器 evaluate 的 JS 函数字符串。
 * 从 React fiber 树中向上最多走 10 层,找到含 id 字段的 props.data。
 */
export const getPostDataJs = `

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and that https://web.okjike.com is reachable (curl -I https://web.okjike.com)
  2. Inspect outcome.detail in the message for the underlying fetch error (ENOTFOUND, ECONNRESET, certificate errors) and fix accordingly
  3. If behind a proxy, configure HTTP(S)_PROXY or the CLI's proxy settings correctly
  4. Retry after a short wait if jike is having a transient outage
  5. If it persists, confirm the API endpoint used by the CLI has not changed

Example fix

// before
const body = await body('postJikeApi', '/api/feed', {}); // throws on any transport failure
// after
let body;
try {
  body = await body('postJikeApi', '/api/feed', {});
} catch (err) {
  if (err instanceof CommandExecutionError && /request failed/.test(err.message)) {
    await sleep(2000); // transient network issue: retry once
    body = await body('postJikeApi', '/api/feed', {});
  } else throw err;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const reachable = await fetch('https://web.okjike.com/', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!reachable) throw new Error('web.okjike.com unreachable — check network/proxy before calling');

Type guard

function isTransportFailure(err) {
  return err instanceof CommandExecutionError && /request failed:/.test(err.message);
}

Try / catch

try {
  const body = await body('postJikeApi', path, payload);
} catch (err) {
  if (isTransportFailure(err)) {
    // network-level: retry with backoff or surface a friendly offline message
  } else throw err;
}

Prevention

When it happens

Trigger: Calling any jike API helper (e.g. body('postJikeApi',...)) when the request to web.okjike.com cannot complete: no internet, DNS resolution failure, proxy misconfiguration, TLS handshake failure, or the connection being refused/reset before an HTTP response is received.

Common situations: Developer offline or on a captive portal; corporate proxy blocking web.okjike.com; firewall/DNS issues; jike server outage; wrong base URL after a site endpoint change.

Related errors


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