{"record":{"id":"8a3c61329b757aac","repo":"jackwener/OpenCLI","slug":"this-action-requires-being-logged-in-to-pinterest","errorCode":null,"errorMessage":"This action requires being logged in to Pinterest in Chrome","messagePattern":"This action requires being logged in to Pinterest in Chrome","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":401,"severity":"error","filePath":"clis/pinterest/utils.js","lineNumber":216,"sourceCode":"  const raw = unwrapEvaluateResult(await page.evaluate(resourceFetchScript(url, body)));\n\n  if (raw?.__fetchError) {\n    throw new CommandExecutionError(`Pinterest request failed: ${raw.__fetchError}`);\n  }\n  if (raw?.__noCsrf) {\n    throw new CommandExecutionError(\n      'Pinterest did not set a csrftoken cookie for this page',\n      'Open https://www.pinterest.com in Chrome (logged in) and retry',\n    );\n  }\n  if (raw?.__httpError) {\n    const status = raw.__httpError;\n    // Reads work anonymously, so their 403 is a rejected request, not a login prompt;\n    // writes genuinely need login, so treat their 403 as auth too.\n    if (status === 401 || (WRITE_ACTIONS.has(action) && status === 403)) {\n      // Pinterest also answers 401 for writes it refuses on a logged-in session (e.g. editing the\n      // link of a scraped pin), so pass its own message through instead of only saying \"log in\".\n      throw new AuthRequiredError(\n        PINTEREST_DOMAIN,\n        raw.message\n          ? `Pinterest refused this write: ${raw.message}`\n          : 'This action requires being logged in to Pinterest in Chrome',\n      );\n    }\n    const hint = status === 403 ? ' (missing or expired CSRF token — reload Pinterest in Chrome)' : '';\n    // Surface Pinterest's own error text (from resource_response.error.message) when present.\n    const detail = raw.message ? `: ${raw.message}` : '';\n    throw new CommandExecutionError(`Pinterest request failed (HTTP ${status})${detail}${hint}`);\n  }\n  if (!raw || typeof raw !== 'object' || raw.__malformed) {\n    throw new CommandExecutionError('Pinterest request returned malformed JSON payload');\n  }\n  const resourceResponse = raw.resource_response;\n  if (!resourceResponse || typeof resourceResponse !== 'object') {\n    throw new CommandExecutionError('Pinterest request returned malformed API payload');\n  }","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/utils.js#L198-L234","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Log in to Pinterest in the attached Chrome window and retry","Confirm you own the target board/ pin for write operations","If Pinterest passed its own message, follow what it says (e.g. not allowed for scraped pins)","Check your Pinterest account status for restrictions"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"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; }","preventionTips":["Confirm the Chrome session is logged into Pinterest before write operations","Only perform writes on boards and pins you own","Remember some writes (e.g. editing scraped-pin links) are refused even when logged in — check Pinterest's passthrough message","Keep the session alive; re-login if it expired"],"tags":["auth","http-401","http-403","pinterest","login"],"backgroundTag":"authentication-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}