jackwener/OpenCLI · error · CommandExecutionError

Repin did not return a pin id

Error message

Repin did not return a pin id

What it means

Thrown in clis/pinterest/save.js:48 when pinterestResourceCreate on RepinResource returns no object or an object without an id. Without a new pin id the command can't confirm the save happened nor move it to a section, so it raises instead of returning partial results.

Source

Thrown at clis/pinterest/save.js:48

    if (boardRef) {
      const { username, slug, path, board } = await resolveBoardTarget(page, boardRef);
      await page.goto(`${PINTEREST_BASE}${path}`);

      const { boardId } = await resolveBoardId(page, username, slug, path, board);
      options.board_id = boardId;
      sourceUrl = path;
      // Validate --section before repinning, so a bad value fails before anything is created.
      if (section) sectionId = (await resolveSection(page, options.board_id, section, path)).sectionId;
    } else {
      // No board given: Pinterest routes a boardless repin to the profile's Quick Saves board.
      await page.goto(`${PINTEREST_BASE}/`);
    }

    const created = await pinterestResourceCreate(page, 'RepinResource', options, sourceUrl);
    const newId = created && created.id;
    if (!newId) {
      throw new CommandExecutionError('Repin did not return a pin id');
    }

    if (sectionId) {
      await movePinToSection(page, newId, options.board_id, sectionId, sourceUrl);
    }

    return [{
      pinId: String(newId),
      sourcePinId,
      board: (created.board && created.board.name) || (boardRef || 'profile'),
      url: `${PINTEREST_BASE}/pin/${newId}/`,
    }];
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Refresh session cookies / re-login, then retry the save
  2. Verify the source pin still exists and is publicly saveable (`pin <sourcePinId>` or open its URL)
  3. Confirm the target board is valid and writable; retry with a different board if unsure
  4. Slow down bulk scripts (add delays) and retry later if rate-limited; check the RepinResource/create response in a browser if it persists
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the source pin still exists before repinning
const src = await run(['pin', sourcePinId]).catch(() => null);
if (!src) throw new Error(`Source pin ${sourcePinId} is gone or inaccessible`);

Type guard

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

Try / catch

try {
  await run(['save', '--pin', sourcePinId, '--board', board]);
} catch (e) {
  if (/Repin did not return a pin id/.test(e.message)) {
    await refreshSession();
    return retry(() => run(['save', '--pin', sourcePinId, '--board', board]), 1);
  }
  throw e;
}

Prevention

When it happens

Trigger: The RepinResource/create call responds with an empty/failed payload — expired session cookies, the source pin was deleted or private (unrepinnable), target board unavailable, rate limiting, or Pinterest API changes breaking response extraction.

Common situations: Repining a pin that was deleted moments earlier; saving to a board you lost access to; automated bulk saves hitting rate limits; stale cookies in long-running scripts; blocked/flagged accounts where Pinterest silently drops saves.

Related errors


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