{"record":{"id":"e1e218c6912be9d9","repo":"jackwener/OpenCLI","slug":"pin-creation-did-not-return-a-pin-id","errorCode":null,"errorMessage":"Pin creation did not return a pin id","messagePattern":"Pin creation did not return a pin id","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/pin-create.js","lineNumber":62,"sourceCode":"    const link = String(kwargs.link ?? '').trim();\n\n    await page.goto(`${PINTEREST_BASE}${path}`);\n\n    // Resolve the numeric board id the create call needs.\n    const { boardId } = await resolveBoardId(page, username, slug, path, preloadedBoard);\n\n    // Validate --section before creating, so a bad value fails before a pin exists.\n    const sectionId = section ? (await resolveSection(page, boardId, section, path)).sectionId : '';\n\n    const options = { board_id: boardId, image_url: imageUrl, method: 'scraped' };\n    if (title) options.title = title;\n    if (description) options.description = description;\n    if (link) options.link = link;\n\n    const created = await pinterestResourceCreate(page, 'PinResource', options, path);\n    const newId = created && created.id;\n    if (!newId) {\n      throw new CommandExecutionError('Pin creation did not return a pin id');\n    }\n\n    if (sectionId) {\n      await movePinToSection(page, newId, boardId, sectionId, path);\n    }\n\n    return [{\n      pinId: String(newId),\n      board: (created.board && created.board.name) || `${username}/${slug}`,\n      title: (created.title || created.grid_title || title || '').trim(),\n      url: `${PINTEREST_BASE}/pin/${newId}/`,\n    }];\n  },\n});\n","sourceCodeStart":44,"sourceCodeEnd":77,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/pin-create.js#L44-L77","documentation":"This CommandExecutionError is thrown in clis/pinterest/pin-create.js:62 after pinterestResourceCreate posts to PinResource/create: if the resource response is falsy or has no `id`, the library cannot know a pin was created, so it fails rather than return a pinId. It is a sanity check that the create call actually yielded a pin object.","triggerScenarios":"The PinResource/create call completes but returns null/undefined or an object without `id` — e.g. Pinterest returned an error payload, a redirect/empty body due to session expiry, a silent moderation rejection (spam/blocked domain), or the response shape changed.","commonSituations":"Expired or invalid session cookies (cookie-based Strategy), image URL blocked by Pinterest spam filters so the pin is dropped, board id resolved incorrectly, Pinterest DOM/API changes breaking the resource-call extraction, rate limiting returning empty responses.","solutions":["Re-run with a fresh authenticated session — re-login / refresh cookies, since an expired session often yields empty responses","Try a different, plainly-hosted image URL on a reputable domain; Pinterest silently rejects spammy or unscrapable images","Confirm the board exists and is writable (can you add a pin to it in the browser?)","Retry later if rate-limited; if it persists, inspect the network response of PinResource/create in a browser to see Pinterest's error field and update the library's response parsing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const probe = await fetch(imageUrl, { method: 'HEAD' });\nif (!probe.ok) throw new Error('Image URL is not publicly reachable');","typeGuard":"function hasPinId(res) {\n  return res !== null && typeof res === 'object' && res.id !== undefined && res.id !== null;\n}","tryCatchPattern":"try {\n  await run(['pin-create', imageUrl, '--board', board]);\n} catch (e) {\n  if (/did not return a pin id/.test(e.message)) {\n    // refresh session cookies, then retry once\n    await refreshSession();\n    return retry(() => run(['pin-create', imageUrl, '--board', board]), 1);\n  }\n  throw e;\n}","preventionTips":["Keep session cookies fresh; re-login when resource calls start returning empty","Use reputable, directly fetchable image URLs (Pinterest silently rejects spammy images)","Confirm the target board is writable before creating","Back off and retry on bursts — empty create responses often indicate rate limiting"],"tags":["network","pinterest","api-response","session"],"backgroundTag":"empty-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}