jackwener/OpenCLI · error · CommandExecutionError

Could not resolve pin "${id}" (does it exist and do you own

Error message

Could not resolve pin "${id}" (does it exist and do you own it?)

What it means

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.

Source

Thrown at clis/pinterest/pin-delete.js:31

  args: [
    { name: 'pin', type: 'string', positional: true, required: true, help: 'Pin id or pin URL, e.g. 1234567890123456' },
    { name: 'confirm', type: 'bool', default: false, help: 'Actually delete — without it the pin is only previewed' },
  ],
  columns: ['pinId', 'title', 'board', 'deleted'],
  func: async (page, kwargs) => {
    const id = parsePinId(kwargs.pin);
    const sourceUrl = `/pin/${id}/`;

    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);

    const { data: pin } = await pinterestResourceFetch(
      page,
      'PinResource',
      { id, field_set_key: 'detailed' },
      sourceUrl,
    );
    if (!pin || !pin.id) {
      throw new CommandExecutionError(`Could not resolve pin "${id}" (does it exist and do you own it?)`);
    }

    const row = {
      pinId: String(pin.id),
      title: (pin.title || pin.grid_title || '').trim(),
      board: (pin.board && pin.board.name) || '',
      deleted: false,
    };

    if (kwargs.confirm !== true) {
      throw new ArgumentError(
        `Refusing to delete pin ${row.pinId}${row.title ? ` "${row.title}"` : ''}${row.board ? ` from board "${row.board}"` : ''} without --confirm`,
        'Re-run with --confirm once you are sure; deleting a pin cannot be undone',
      );
    }

    await pinterestResourceDelete(page, 'PinResource', { id: row.pinId }, sourceUrl);
    return [{ ...row, deleted: true }];

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the pin exists and is yours by opening its URL in a logged-in browser before deleting
  2. 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
  3. Refresh your session cookies / re-login if lookups are returning empty across commands
  4. If the pin is in another account's board, you cannot delete it — remove your own repin/save instead

Example fix

// before
$ opencli pinterest pin-delete 9988776655
// error: Could not resolve pin "9988776655"
// after (verify id first)
$ opencli pinterest pin 9988776655   # confirm it resolves and is yours
$ opencli pinterest pin-delete 9988776655 --confirm
Defensive patterns

Strategy: validation

Validate before calling

// resolve the pin first; skip delete if it doesn't resolve
const existing = await run(['pin', pinId]).catch(() => null);
if (!existing) throw new Error(`Pin ${pinId} not found or not owned by you`);

Type guard

function isResolvablePin(pin) {
  return pin !== null && typeof pin === 'object' && pin.id !== undefined;
}

Try / catch

try {
  await run(['pin-delete', pinId, '--confirm']);
} catch (e) {
  if (/Could not resolve pin/.test(e.message)) {
    console.warn(`Skipping ${pinId}: not found, already deleted, or not owned`);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/41849c85f60aa643. Report an issue: GitHub.