jackwener/OpenCLI · error · AuthRequiredError

This action requires being logged in to Pinterest in Chrome

Error message

This action requires being logged in to Pinterest in Chrome

What it means

Pinterest returned 401, or 403 on a write action, meaning the session is not logged in (or Pinterest refused the write on the current session). The library throws AuthRequiredError, passing through Pinterest's own message when available since some writes are refused even while logged in.

Source

Thrown at clis/pinterest/utils.js:216

  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}`
          : 'This action requires being logged in to Pinterest in Chrome',
      );
    }
    const hint = status === 403 ? ' (missing or expired CSRF token — reload Pinterest in Chrome)' : '';
    // Surface Pinterest's own error text (from resource_response.error.message) when present.
    const detail = raw.message ? `: ${raw.message}` : '';
    throw new CommandExecutionError(`Pinterest request failed (HTTP ${status})${detail}${hint}`);
  }
  if (!raw || typeof raw !== 'object' || raw.__malformed) {
    throw new CommandExecutionError('Pinterest request returned malformed JSON payload');
  }
  const resourceResponse = raw.resource_response;
  if (!resourceResponse || typeof resourceResponse !== 'object') {
    throw new CommandExecutionError('Pinterest request returned malformed API payload');
  }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log in to Pinterest in the attached Chrome window and retry
  2. Confirm you own the target board/ pin for write operations
  3. If Pinterest passed its own message, follow what it says (e.g. not allowed for scraped pins)
  4. Check your Pinterest account status for restrictions
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try { await cmd.editPin(args); } catch (e) { if (e instanceof AuthRequiredError || /logged in to Pinterest/.test(e.message)) { console.error('Log in to Pinterest in Chrome and retry.'); } else throw e; }

Prevention

When it happens

Trigger: Any resource call where Pinterest answers HTTP 401; write actions (WRITE_ACTIONS) answered with HTTP 403, e.g. editing the link of a scraped pin, creating a pin on a board you don't own, or pinning while logged out.

Common situations: Chrome logged out of Pinterest (session expired); using a Chrome profile different from the logged-in one; attempting writes Pinterest disallows for that pin type; Pinterest account restricted or suspended.

Related errors


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