{"record":{"id":"437132e1ec7487bd","repo":"jackwener/OpenCLI","slug":"pinterest-pin","errorCode":null,"errorMessage":"pinterest pin","messagePattern":"pinterest pin","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/pinterest/pin.js","lineNumber":30,"sourceCode":"  strategy: Strategy.COOKIE,\n  args: [\n    { name: 'pin', type: 'string', positional: true, required: true, help: 'Pin id or pin URL, e.g. 1234567890123456' },\n  ],\n  columns: ['pinId', 'title', 'description', 'pinner', 'board', 'saveCount', 'commentCount', 'link', 'imageUrl', 'url'],\n  func: async (page, kwargs) => {\n    const id = parsePinId(kwargs.pin);\n    const sourceUrl = `/pin/${id}/`;\n\n    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);\n\n    const { data: pin } = await pinterestResourceFetch(\n      page,\n      'PinResource',\n      { id, field_set_key: 'detailed' },\n      sourceUrl,\n    );\n    if (!pin || !pin.id) {\n      throw new EmptyResultError('pinterest pin', `pin \"${id}\" not found`);\n    }\n\n    return [\n      {\n        pinId: String(pin.id),\n        title: (pin.title || pin.grid_title || '').trim(),\n        description: (typeof pin.description === 'string' ? pin.description : '').trim(),\n        pinner: (pin.pinner && pin.pinner.username) || '',\n        board: (pin.board && pin.board.name) || '',\n        saveCount: typeof pin.repin_count === 'number' ? pin.repin_count : 0,\n        commentCount: typeof pin.comment_count === 'number' ? pin.comment_count : 0,\n        link: pin.link || '',\n        imageUrl: pickPinImage(pin.images),\n        url: `${PINTEREST_BASE}/pin/${pin.id}/`,\n      },\n    ];\n  },\n});","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/pin.js#L12-L48","documentation":"An EmptyResultError raised in clis/pinterest/pin.js:30 when the PinResource detailed fetch returns no pin or a pin without an id while looking up `pin <id>`. The command signals 'no data' (empty result) rather than a crash, with the message naming the command and the unresolved pin id.","triggerScenarios":"`pin <id>` called with a nonexistent, already-deleted, or other-user's pin id; a malformed id; or the authenticated request returning empty due to invalid session cookies.","commonSituations":"Pinning an id from search results that was since deleted; typos or truncated ids copied from logs; viewing another account's pin while logged into a restricted/flagged account; expired cookies making all detailed lookups empty.","solutions":["Verify the pin id and that the pin still exists by opening its /pin/<id>/ URL in a browser","If the pin belongs to another user and is private/deleted, it cannot be fetched — use a live pin id","Refresh session cookies / re-login if every lookup returns empty","Re-run the list command to get current, valid pin ids"],"exampleFix":"// before\n$ opencli pinterest pin 0000000000001\n// EmptyResultError: pinterest pin — pin \"0000000000001\" not found\n// after (fetch a valid id first)\n$ opencli pinterest board-pins me/ideas   # pick a live pinId\n$ opencli pinterest pin <validPinId>","handlingStrategy":"try-catch","validationCode":"// pre-check with a cheap HEAD on the pin URL\nconst res = await fetch(`https://www.pinterest.com/pin/${pinId}/`, { method: 'HEAD' });\nif (res.status >= 400) throw new Error(`Pin ${pinId} does not exist or is private`);","typeGuard":"function isNonEmptyPin(pin) {\n  return pin !== null && typeof pin === 'object' && typeof pin.id !== 'undefined';\n}","tryCatchPattern":"try {\n  const pin = await run(['pin', pinId]);\n} catch (e) {\n  if (/not found/.test(e.message)) {\n    return null; // treat as missing pin, not a crash\n  }\n  throw e;\n}","preventionTips":["Fetch pin ids fresh from list/board commands instead of caching them","Expect deleted/private pins and handle missing results gracefully in automation","Refresh session cookies when detailed lookups consistently return empty","Validate id format (numeric, full length) before lookup"],"tags":["pinterest","empty-result","not-found","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}