{"record":{"id":"c2117bbc921089a4","repo":"jackwener/OpenCLI","slug":"pinterest-user","errorCode":null,"errorMessage":"pinterest user","messagePattern":"pinterest user","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/user.js","lineNumber":30,"sourceCode":"  strategy: Strategy.COOKIE,\n  args: [\n    { name: 'username', type: 'string', positional: true, required: true, help: 'Username or profile URL, e.g. janedoe' },\n  ],\n  columns: ['username', 'fullName', 'followerCount', 'followingCount', 'interestFollowingCount', 'pinCount', 'boardCount', 'about', 'website', 'url'],\n  func: async (page, kwargs) => {\n    const username = parseUsername(kwargs.username);\n    const sourceUrl = `/${username}/`;\n\n    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);\n\n    const { data: user } = await pinterestResourceFetch(\n      page,\n      'UserResource',\n      { username, field_set_key: 'profile' },\n      sourceUrl,\n    );\n    if (!user || !user.username) {\n      throw new EmptyResultError('pinterest user', `user \"${username}\" not found`);\n    }\n\n    const num = (value) => (typeof value === 'number' ? value : 0);\n    return [{\n      username: user.username,\n      fullName: (user.full_name || '').trim(),\n      followerCount: num(user.follower_count),\n      // following_count is Pinterest's API total (followed people + topics/interests).\n      followingCount: num(user.following_count),\n      interestFollowingCount: num(user.interest_following_count),\n      pinCount: num(user.pin_count),\n      boardCount: num(user.board_count),\n      about: (user.about || '').trim(),\n      website: user.domain_url || '',\n      url: `${PINTEREST_BASE}/${user.username}/`,\n    }];\n  },\n});","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/user.js#L12-L48","documentation":"EmptyResultError from pinterest user: the UserResource API call with field_set_key 'profile' returned no user object (or one without a username), meaning the profile could not be resolved. The command throws so callers get a clear 'user not found' signal instead of undefined data.","triggerScenarios":"Requesting /<username>/ where the account does not exist, was deleted or suspended, is private, or where the UserResource response arrives empty (rate limit, region block, or markup/API change).","commonSituations":"Typos in the username, following a stale cached username after the user renamed their handle, scraping deactivated accounts from an old list, or Pinterest throttling the automation session.","solutions":["Verify the username by opening https://pinterest.com/<username>/ in a browser","Correct stale usernames from your data source (renamed handles are common)","Retry after a delay/backoff if the account is known-good — empty UserResource responses can be transient","Catch EmptyResultError and mark the account as missing/unavailable in your pipeline"],"exampleFix":"// before\nconst user = await pinterest.user({ username: 'old_handle' }); // throws if gone\n// after\ntry {\n  return await pinterest.user({ username: 'old_handle' });\n} catch (e) {\n  if (e.name === 'EmptyResultError') return { status: 'user-not-found' };\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (!/^[A-Za-z0-9_]{3,}$/.test(username)) throw new Error('pre-check: username looks invalid');","typeGuard":null,"tryCatchPattern":"try { user = await pinterest.user({ username }); }\ncatch (e) {\n  if (e.name === 'EmptyResultError') return { found: false, username };\n  throw e;\n}","preventionTips":["Resolve usernames from source URLs shortly after collecting them — handles get renamed","Retry with backoff before declaring a known-good account missing","Check for typos and account suspension when a profile 404s in the browser too"],"tags":["empty-results","user-profile","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}