jackwener/OpenCLI · error · CommandExecutionError

HTTP ${result.httpStatus} from /api/v1/auths/

Error message

HTTP ${result.httpStatus} from /api/v1/auths/

What it means

CommandExecutionError thrown by verifyQwenIdentity when the whoami probe reports kind:'http' — the /api/v1/auths/ endpoint answered with a non-auth, unexpected HTTP status (result.httpStatus interpolated into the message). The token was accepted far enough not to be 'auth' but the API call itself failed.

Source

Thrown at clis/qwen/auth.js:37

  const result = await page.evaluate(`(async () => {
    try {
      const token = ${JSON.stringify(token)};
      const res = await fetch('/api/v1/auths/', { credentials: 'include', headers: { 'Authorization': 'Bearer ' + token, 'Accept': 'application/json' } });
      if (res.status === 401 || res.status === 403) {
        return { kind: 'auth', detail: 'Qwen /api/v1/auths/ HTTP ' + res.status };
      }
      if (!res.ok) return { kind: 'http', httpStatus: res.status };
      const d = await res.json();
      if (!d || !d.id) {
        return { kind: 'auth', detail: 'Qwen /api/v1/auths/ returned no user id' };
      }
      return { ok: true, user_id: String(d.id), name: String(d.name || '') };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('qwen.ai', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /api/v1/auths/`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`Qwen whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected Qwen probe: ${JSON.stringify(result)}`);
  return { user_id: result.user_id, name: result.name };
}

registerSiteAuthCommands({
  site: 'qwen',
  domain: 'qwen.ai',
  loginUrl: 'https://chat.qwen.ai/auth?action=login',
  columns: ['user_id', 'name'],
  quickCheck: hasQwenSessionCookie,
  verify: verifyQwenIdentity,
  poll: async (page) => {
    if (!await hasQwenSessionCookie(page)) {
      throw new AuthRequiredError('qwen.ai', 'Waiting for Qwen token cookie');
    }
    return verifyQwenIdentity(page);
  },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry after a short backoff — transient 5xx/429 usually clears.
  2. Check qwen.ai service status; wait out rate limits before retrying.
  3. Inspect the interpolated HTTP status: 429 -> backoff, 404 -> API changed, update the endpoint/library.
  4. Verify network/proxy settings allow requests to chat.qwen.ai from the automation browser.

Example fix

// before
const me = await verifyQwenIdentity(page);
// after
let me;
for (let i = 0; i < 3; i++) {
  try { me = await verifyQwenIdentity(page); break; }
  catch (e) {
    if (/HTTP (5\d\d|429)/.test(e.message) && i < 2) { await sleep(2000 * (i + 1)); continue; }
    throw e;
  }
}
Defensive patterns

Strategy: retry

Validate before calling

// basic reachability check before verification
const reachable = await fetch('https://chat.qwen.ai/').then(r => r.ok).catch(() => false);
if (!reachable) { console.error('chat.qwen.ai unreachable - check network/proxy'); process.exit(2); }

Type guard

function isTransientHttpError(e) {
  return /HTTP (5\d\d|429) from \/api\/v1\/auths\//.test(String(e?.message));
}

Try / catch

try {
  me = await verifyQwenIdentity(page);
} catch (e) {
  if (isTransientHttpError(e)) {
    await sleep(5000);
    me = await verifyQwenIdentity(page);
  } else { throw e; }
}

Prevention

When it happens

Trigger: Server returns 5xx, 429 (rate limit), 404 (endpoint moved), or a proxy/CDN error page during the whoami fetch inside page.evaluate.

Common situations: qwen.ai outage or maintenance; aggressive rate limiting from repeated probes; corporate proxy/WAF intercepting the request; API version bumped (v1 path removed).

Related errors


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