jackwener/OpenCLI · error · CommandExecutionError
Pinterest request failed: ${raw.__fetchError}
Error message
Pinterest request failed: ${raw.__fetchError} What it means
pinterestResourceFetch runs an in-page fetch against Pinterest's /resource/ endpoints via Chrome. When the injected script reports a __fetchError (network failure, aborted request, or script exception), the library wraps it as CommandExecutionError prefixed 'Pinterest request failed'.
Source
Thrown at clis/pinterest/utils.js:201
}
try { return JSON.parse(text); } catch { return { __malformed: true }; }
} catch (err) {
return { __fetchError: (err && err.message) || String(err) };
}
})()
`;
}
/** POST a resource action ('get' | 'create' | 'update' | 'delete'); returns { data, results, bookmark }. */
export async function pinterestResourceFetch(page, resource, options, sourceUrl, action = 'get') {
const data = JSON.stringify({ options, context: {} });
const body = `source_url=${encodeURIComponent(sourceUrl)}&data=${encodeURIComponent(data)}`;
const url = `/resource/${resource}/${action}/`;
const raw = unwrapEvaluateResult(await page.evaluate(resourceFetchScript(url, body)));
if (raw?.__fetchError) {
throw new CommandExecutionError(`Pinterest request failed: ${raw.__fetchError}`);
}
if (raw?.__noCsrf) {
throw new CommandExecutionError(
'Pinterest did not set a csrftoken cookie for this page',
'Open https://www.pinterest.com in Chrome (logged in) and retry',
);
}
if (raw?.__httpError) {
const status = raw.__httpError;
// Reads work anonymously, so their 403 is a rejected request, not a login prompt;
// writes genuinely need login, so treat their 403 as auth too.
if (status === 401 || (WRITE_ACTIONS.has(action) && status === 403)) {
// Pinterest also answers 401 for writes it refuses on a logged-in session (e.g. editing the
// link of a scraped pin), so pass its own message through instead of only saying "log in".
throw new AuthRequiredError(
PINTEREST_DOMAIN,
raw.message
? `Pinterest refused this write: ${raw.message}`View on GitHub (pinned to 49907e53dc)
Solutions
- Check network connectivity and that pinterest.com loads in the attached Chrome window
- Retry the command; transient connection failures often clear
- Disable proxy/VPN or corporate blocking for pinterest.com
- Reload the Pinterest tab in Chrome so the page is in a healthy state before retrying
Defensive patterns
Strategy: retry
Validate before calling
if (!navigator.onLine) throw new Error('offline: Pinterest calls require connectivity');
const ok = await fetch('https://www.pinterest.com', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!ok) throw new Error('pinterest.com unreachable'); Type guard
null
Try / catch
try { await cmd.board(target); } catch (e) { if (/Pinterest request failed/.test(e.message)) { await sleep(2000); return cmd.board(target); } throw e; } Prevention
- Check connectivity before batch operations
- Keep the attached Chrome tab open and healthy during calls
- Avoid closing or navigating the Pinterest tab mid-command
- Add backoff between scripted resource calls
When it happens
Trigger: Chrome page is offline or Pinterest is unreachable; page.evaluate throws and the failure is surfaced as __fetchError; the resource URL/body fails to fetch due to DNS, TLS, or connection reset; navigating away mid-request.
Common situations: Laptop lost Wi-Fi mid-command; corporate proxy blocks pinterest.com; Chrome tab crashed or was closed during the call; Pinterest served a captcha/interstitial that broke the in-page fetch.
Related errors
- FETCH_ERROR
- archive search request failed: ${error?.message || error}
- archive wayback request failed: ${error?.message || error}
- ${label} request failed: ${err?.message ?? err}
- 字幕获取失败: ${err?.message || err}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f7c092fcf9034bd1.
Report an issue: GitHub.