jackwener/OpenCLI · error · CommandExecutionError
Pixiv cookie lookup failed: ${error?.message || error}
Error message
Pixiv cookie lookup failed: ${error?.message || error} What it means
For illustration downloads, the command needs the browser session's Pixiv cookies: page.getCookies({ domain: 'pixiv.net' }). If that call rejects, the error is wrapped in this CommandExecutionError. This keeps cookie-retrieval failures distinct from download failures and ensures cleanup/rollback logic sees a typed error.
Source
Thrown at clis/pixiv/bookmark-download.js:192
plans.push({ ...await prepareIllustPlan(page, row, outputRoot), row });
}
}
const targets = new Set();
for (const plan of plans) {
const target = plan.kind === 'novel' ? plan.destPath : plan.finalPath;
if (targets.has(target)) {
throw new CommandExecutionError(`Pixiv bookmark archive contains a duplicate download target: ${target}`);
}
targets.add(target);
}
let cookies = '';
if (type === 'illust') {
let rawCookies;
try {
rawCookies = await page.getCookies({ domain: 'pixiv.net' });
} catch (error) {
throw new CommandExecutionError(`Pixiv cookie lookup failed: ${error?.message || error}`);
}
if (!Array.isArray(rawCookies)) {
throw new CommandExecutionError('Pixiv cookie lookup returned malformed data');
}
try {
cookies = formatCookieHeader(rawCookies);
} catch (error) {
throw new CommandExecutionError(`Pixiv cookie lookup returned malformed entries: ${error?.message || error}`);
}
}
const committed = [];
try {
const results = [];
for (const plan of plans) {
const destination = plan.kind === 'novel'
? commitNovelFile(plan)
: await commitIllustPlan(plan, cookies);View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command so a fresh page/browser context is created
- Ensure the browser session stays open until after cookie retrieval (don't close the page mid-run)
- Verify the Playwright/Puppeteer connection to the browser is alive and the page is on a pixiv.net URL
- Re-login to Pixiv in the automation browser if the session is broken
- Catch this error and retry once with a new page before failing
Example fix
// before
rawCookies = await page.getCookies({ domain: 'pixiv.net' });
// after: ensure a live page first
if (page.isClosed?.()) page = await newPixivPage();
rawCookies = await page.getCookies({ domain: 'pixiv.net' }); Defensive patterns
Strategy: retry
Validate before calling
if (!page || typeof page.getCookies !== 'function' || page.isClosed?.()) {
throw new Error('page is not usable for cookie lookup');
} Type guard
function canReadCookies(page) {
return !!page && typeof page.getCookies === 'function' && !page.isClosed?.();
} Try / catch
let rawCookies;
for (let attempt = 0; attempt < 2; attempt++) {
try {
rawCookies = await page.getCookies({ domain: 'pixiv.net' });
break;
} catch (err) {
if (attempt === 1) throw new Error(`Pixiv cookie lookup failed: ${err.message}`);
page = await newPixivPage(); // recreate the page once
}
} Prevention
- Keep the browser page open until after cookie retrieval
- Recreate the page/context if isClosed() reports true
- Confirm the browser process is alive before the download phase
- Use fresh, logged-in Pixiv sessions
When it happens
Trigger: page.getCookies rejects — the browser page/target has been closed or crashed, the automation session (Playwright/Puppeteer) was disconnected, or the driver throws an internal error while reading the cookie jar.
Common situations: Page closed by the user or a timeout before cookie retrieval; browser crashed or was killed; connecting to a remote browser that dropped; calling bookmark-download outside a properly initialized browser context.
Related errors
- LinkedIn sent-invitations verification requires an active si
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- Pixiv cookie lookup returned malformed data
- Pixiv cookie lookup returned malformed entries: ${error?.mes
- 12306 tk auth cookie missing
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d18eeebd0077e44f.
Report an issue: GitHub.