jackwener/OpenCLI · error · CommandExecutionError
Pin creation did not return a pin id
Error message
Pin creation did not return a pin id
What it means
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.
Source
Thrown at clis/pinterest/pin-create.js:62
const link = String(kwargs.link ?? '').trim();
await page.goto(`${PINTEREST_BASE}${path}`);
// Resolve the numeric board id the create call needs.
const { boardId } = await resolveBoardId(page, username, slug, path, preloadedBoard);
// Validate --section before creating, so a bad value fails before a pin exists.
const sectionId = section ? (await resolveSection(page, boardId, section, path)).sectionId : '';
const options = { board_id: boardId, image_url: imageUrl, method: 'scraped' };
if (title) options.title = title;
if (description) options.description = description;
if (link) options.link = link;
const created = await pinterestResourceCreate(page, 'PinResource', options, path);
const newId = created && created.id;
if (!newId) {
throw new CommandExecutionError('Pin creation did not return a pin id');
}
if (sectionId) {
await movePinToSection(page, newId, boardId, sectionId, path);
}
return [{
pinId: String(newId),
board: (created.board && created.board.name) || `${username}/${slug}`,
title: (created.title || created.grid_title || title || '').trim(),
url: `${PINTEREST_BASE}/pin/${newId}/`,
}];
},
});
View on GitHub (pinned to 49907e53dc)
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
Defensive patterns
Strategy: try-catch
Validate before calling
const probe = await fetch(imageUrl, { method: 'HEAD' });
if (!probe.ok) throw new Error('Image URL is not publicly reachable'); Type guard
function hasPinId(res) {
return res !== null && typeof res === 'object' && res.id !== undefined && res.id !== null;
} Try / catch
try {
await run(['pin-create', imageUrl, '--board', board]);
} catch (e) {
if (/did not return a pin id/.test(e.message)) {
// refresh session cookies, then retry once
await refreshSession();
return retry(() => run(['pin-create', imageUrl, '--board', board]), 1);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Pin update did not return the updated pin
- Repin did not return a pin id
- Bilibili ${label} API returned a malformed payload
- Bilibili ${label} API failed: ${message} (${payload.code})
- coingecko global returned malformed JSON: ${err?.message ??
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e1e218c6912be9d9.
Report an issue: GitHub.