{"record":{"id":"41849c85f60aa643","repo":"jackwener/OpenCLI","slug":"could-not-resolve-pin-id-does-it-exist-and-d","errorCode":null,"errorMessage":"Could not resolve pin \"${id}\" (does it exist and do you own it?)","messagePattern":"Could not resolve pin \"(.+?)\" \\(does it exist and do you own it\\?\\)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/pin-delete.js","lineNumber":31,"sourceCode":"  args: [\n    { name: 'pin', type: 'string', positional: true, required: true, help: 'Pin id or pin URL, e.g. 1234567890123456' },\n    { name: 'confirm', type: 'bool', default: false, help: 'Actually delete — without it the pin is only previewed' },\n  ],\n  columns: ['pinId', 'title', 'board', 'deleted'],\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 CommandExecutionError(`Could not resolve pin \"${id}\" (does it exist and do you own it?)`);\n    }\n\n    const row = {\n      pinId: String(pin.id),\n      title: (pin.title || pin.grid_title || '').trim(),\n      board: (pin.board && pin.board.name) || '',\n      deleted: false,\n    };\n\n    if (kwargs.confirm !== true) {\n      throw new ArgumentError(\n        `Refusing to delete pin ${row.pinId}${row.title ? ` \"${row.title}\"` : ''}${row.board ? ` from board \"${row.board}\"` : ''} without --confirm`,\n        'Re-run with --confirm once you are sure; deleting a pin cannot be undone',\n      );\n    }\n\n    await pinterestResourceDelete(page, 'PinResource', { id: row.pinId }, sourceUrl);\n    return [{ ...row, deleted: true }];","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/pin-delete.js#L13-L49","documentation":"Thrown in clis/pinterest/pin-delete.js:31 when pinterestResourceGet on PinResource (field_set_key 'detailed') returns nothing usable — no pin object or an object without an id. The delete command refuses to proceed because it needs the pin's metadata (title, board) for the confirmation prompt and the numeric id for the delete call.","triggerScenarios":"Running `pin-delete` with a pin id that doesn't exist, was already deleted, belongs to another user (you can only delete pins you own), or is a malformed/unresolvable id reference; also when the detailed fetch fails due to session issues.","commonSituations":"Deleting a pin that was removed by someone else or by you in another terminal; copying a pin id from a different account; passing a slug/URL fragment that can't be resolved to a pin id; expired cookies causing an empty resource response.","solutions":["Verify the pin exists and is yours by opening its URL in a logged-in browser before deleting","Re-check the pin id/argument you passed — typo'd or stale ids are the usual cause; re-run `pin` to list current pins and copy a fresh id","Refresh your session cookies / re-login if lookups are returning empty across commands","If the pin is in another account's board, you cannot delete it — remove your own repin/save instead"],"exampleFix":"// before\n$ opencli pinterest pin-delete 9988776655\n// error: Could not resolve pin \"9988776655\"\n// after (verify id first)\n$ opencli pinterest pin 9988776655   # confirm it resolves and is yours\n$ opencli pinterest pin-delete 9988776655 --confirm","handlingStrategy":"validation","validationCode":"// resolve the pin first; skip delete if it doesn't resolve\nconst existing = await run(['pin', pinId]).catch(() => null);\nif (!existing) throw new Error(`Pin ${pinId} not found or not owned by you`);","typeGuard":"function isResolvablePin(pin) {\n  return pin !== null && typeof pin === 'object' && pin.id !== undefined;\n}","tryCatchPattern":"try {\n  await run(['pin-delete', pinId, '--confirm']);\n} catch (e) {\n  if (/Could not resolve pin/.test(e.message)) {\n    console.warn(`Skipping ${pinId}: not found, already deleted, or not owned`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Verify the pin exists and is yours in a logged-in browser before deleting","Re-fetch fresh pin ids right before delete operations — never reuse cached ids","Handle already-deleted pins gracefully in bulk-delete scripts","Refresh cookies if all lookups return empty"],"tags":["pinterest","lookup-failed","not-found","api-response"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}