jackwener/OpenCLI · error · CommandExecutionError

HTTP ${result.httpStatus} from /web/user

Error message

HTTP ${result.httpStatus} from /web/user

What it means

verifyWereadIdentity in clis/weread/auth.js throws CommandExecutionError when the in-page probe to /web/user returns kind:'http' — the endpoint responded with an HTTP error status other than 401/403 (those are treated as auth failures). This means an unexpected server-side HTTP failure during the identity check.

Source

Thrown at clis/weread/auth.js:40

      if (res.status === 401 || res.status === 403) {
        return { kind: 'auth', detail: 'WeRead /web/user HTTP ' + res.status };
      }
      if (!res.ok) return { kind: 'http', httpStatus: res.status };
      const d = await res.json();
      if (d && d.errCode && d.errCode !== 0) {
        return { kind: 'auth', detail: 'WeRead /web/user errCode=' + d.errCode };
      }
      return {
        ok: true,
        user_id: String(d.userVid || wrVid),
        name: String(d.name || d.nickName || ''),
      };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('weread.qq.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /web/user`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`WeRead whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected WeRead probe: ${JSON.stringify(result)}`);
  return { user_id: result.user_id, name: result.name };
}

registerSiteAuthCommands({
  site: 'weread',
  domain: 'weread.qq.com',
  loginUrl: 'https://weread.qq.com/',
  columns: ['user_id', 'name'],
  quickCheck: hasWereadSessionCookie,
  verify: verifyWereadIdentity,
  poll: async (page) => {
    if (!await hasWereadSessionCookie(page)) {
      throw new AuthRequiredError('weread.qq.com', 'Waiting for WeRead wr_vid cookie');
    }
    return verifyWereadIdentity(page);
  },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry after a delay — 5xx/429 are usually transient; reduce polling frequency if 429.
  2. Check WeRead service status by loading weread.qq.com/web/user in the browser.
  3. Update the CLI if WeRead changed the endpoint path (a persistent 404 suggests an API change).
  4. Run `weread login` verification again once the server recovers.

Example fix

// before: hammering during outage
$ opencli weread whoami
CommandExecutionError: HTTP 502 from /web/user
// after: wait and retry
$ sleep 30 && opencli weread whoami
Defensive patterns

Strategy: retry

Try / catch

for (let i = 0; i < 3; i++) {
  try { return await verifyWereadIdentity(page); }
  catch (e) { if (!/HTTP \d+ from \/web\/user/.test(e.message) || i === 2) throw e; await new Promise(r => setTimeout(r, 3000 * (i + 1))); }
}

Prevention

When it happens

Trigger: Inside page.evaluate, fetch('/web/user', {credentials:'include'}) returns e.g. 404, 429, 500, 502, 503 — WeRead server error, endpoint renamed/moved, or rate limiting.

Common situations: WeRead outage or partial degradation (5xx); rate limiting (429) after rapid polling; WeRead changing/removing the /web/user path in a site update.

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/b98ebf3471e8877d. Report an issue: GitHub.