jackwener/OpenCLI · warning · EmptyResultError
pinterest pin
Error message
pinterest pin
What it means
An EmptyResultError raised in clis/pinterest/pin.js:30 when the PinResource detailed fetch returns no pin or a pin without an id while looking up `pin <id>`. The command signals 'no data' (empty result) rather than a crash, with the message naming the command and the unresolved pin id.
Source
Thrown at clis/pinterest/pin.js:30
strategy: Strategy.COOKIE,
args: [
{ name: 'pin', type: 'string', positional: true, required: true, help: 'Pin id or pin URL, e.g. 1234567890123456' },
],
columns: ['pinId', 'title', 'description', 'pinner', 'board', 'saveCount', 'commentCount', 'link', 'imageUrl', 'url'],
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 EmptyResultError('pinterest pin', `pin "${id}" not found`);
}
return [
{
pinId: String(pin.id),
title: (pin.title || pin.grid_title || '').trim(),
description: (typeof pin.description === 'string' ? pin.description : '').trim(),
pinner: (pin.pinner && pin.pinner.username) || '',
board: (pin.board && pin.board.name) || '',
saveCount: typeof pin.repin_count === 'number' ? pin.repin_count : 0,
commentCount: typeof pin.comment_count === 'number' ? pin.comment_count : 0,
link: pin.link || '',
imageUrl: pickPinImage(pin.images),
url: `${PINTEREST_BASE}/pin/${pin.id}/`,
},
];
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the pin id and that the pin still exists by opening its /pin/<id>/ URL in a browser
- If the pin belongs to another user and is private/deleted, it cannot be fetched — use a live pin id
- Refresh session cookies / re-login if every lookup returns empty
- Re-run the list command to get current, valid pin ids
Example fix
// before $ opencli pinterest pin 0000000000001 // EmptyResultError: pinterest pin — pin "0000000000001" not found // after (fetch a valid id first) $ opencli pinterest board-pins me/ideas # pick a live pinId $ opencli pinterest pin <validPinId>
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check with a cheap HEAD on the pin URL
const res = await fetch(`https://www.pinterest.com/pin/${pinId}/`, { method: 'HEAD' });
if (res.status >= 400) throw new Error(`Pin ${pinId} does not exist or is private`); Type guard
function isNonEmptyPin(pin) {
return pin !== null && typeof pin === 'object' && typeof pin.id !== 'undefined';
} Try / catch
try {
const pin = await run(['pin', pinId]);
} catch (e) {
if (/not found/.test(e.message)) {
return null; // treat as missing pin, not a crash
}
throw e;
} Prevention
- Fetch pin ids fresh from list/board commands instead of caching them
- Expect deleted/private pins and handle missing results gracefully in automation
- Refresh session cookies when detailed lookups consistently return empty
- Validate id format (numeric, full length) before lookup
When it happens
Trigger: `pin <id>` called with a nonexistent, already-deleted, or other-user's pin id; a malformed id; or the authenticated request returning empty due to invalid session cookies.
Common situations: Pinning an id from search results that was since deleted; typos or truncated ids copied from logs; viewing another account's pin while logged into a restricted/flagged account; expired cookies making all detailed lookups empty.
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
- oeis sequence
- bilibili creator-stats ${bvid}
- Chess.com returned 404 for ${url}
- crates crate
- crates.io returned 404 for ${url}.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/437132e1ec7487bd.
Report an issue: GitHub.