jackwener/OpenCLI · error · CommandExecutionError

HTTP ${probe.httpStatus} from Pixiv ajax

Error message

HTTP ${probe.httpStatus} from Pixiv ajax

What it means

The in-page identity probe calls /ajax/user/extra with credentials included. When that endpoint returns a non-OK, non-401/403 status, the probe reports kind='http' and verifyPixivIdentity throws this CommandExecutionError with the HTTP status — the request reached pixiv but failed at the HTTP layer.

Source

Thrown at clis/pixiv/auth.js:45

      const r = await fetch('/ajax/user/extra', { credentials: 'include', headers: { Accept: 'application/json' } });
      if (r.status === 401 || r.status === 403) {
        return { kind: 'auth', detail: 'Pixiv /ajax/user/extra HTTP ' + r.status };
      }
      if (!r.ok) return { kind: 'http', httpStatus: r.status };
      const d = await r.json();
      if (d?.error) return { kind: 'auth', detail: 'Pixiv /ajax/user/extra error=true — anonymous' };
      const phpSess = (document.cookie.split('; ').find(c => c.startsWith('PHPSESSID=')) || '').split('=')[1] || '';
      const uid = phpSess.split('_')[0] || '';
      if (!uid) {
        return { kind: 'auth', detail: 'Pixiv PHPSESSID prefix unparseable' };
      }
      return { ok: true, user_id: uid, name: '' };
    } catch (e) {
      return { kind: 'exception', detail: String(e && e.message || e) };
    }
  })()`);
  if (probe?.kind === 'auth') throw new AuthRequiredError('pixiv.net', probe.detail);
  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Pixiv ajax`);
  if (probe?.kind === 'exception') throw new CommandExecutionError(`Pixiv whoami failed: ${probe.detail}`);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Pixiv probe: ${JSON.stringify(probe)}`);
  return { user_id: probe.user_id, name: probe.name };
}

registerSiteAuthCommands({
  site: 'pixiv',
  domain: 'pixiv.net',
  loginUrl: 'https://accounts.pixiv.net/login',
  columns: ['user_id', 'name'],
  quickCheck: hasPixivSessionCookie,
  verify: verifyPixivIdentity,
  poll: async (page) => {
    if (!await hasPixivSessionCookie(page)) {
      throw new AuthRequiredError('pixiv.net', 'Waiting for Pixiv PHPSESSID cookie');
    }
    return verifyPixivIdentity(page);
  },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait and retry — especially if status was 429 or 5xx.
  2. Check pixiv status/maintenance announcements if errors persist.
  3. Ensure the request originates from a normal logged-in pixiv.net page context (no proxy/bot-block interference).
  4. Slow down scripted pixiv command loops to avoid rate limits.
Defensive patterns

Strategy: retry

Try / catch

try {
  await pixivWhoAmI();
} catch (err) {
  const m = String(err.message).match(/^HTTP (\d+) from Pixiv ajax$/);
  if (m && (m[1] === '429' || m[1].startsWith('5'))) {
    await delay(30_000);
    return pixivWhoAmI(); // bounded retry with backoff
  } else throw err;
}

Prevention

When it happens

Trigger: Pixiv /ajax/user/extra returns 429 (rate limit), 5xx server error, or other non-2xx/non-401/403 status during verifyPixivIdentity's whoami probe.

Common situations: Rate limiting after running many pixiv commands in a row; pixiv server-side incident/maintenance window; corporate proxy or bot-protection (e.g. a challenge page) intercepting the ajax call; transient network flake.

Related errors


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