jackwener/OpenCLI · error · ArgumentError
Not a board reference: "${trimmed}"
Error message
Not a board reference: "${trimmed}" What it means
After ruling out URLs, <username>/<slug> pairs, and numeric ids, resolveBoardTarget throws ArgumentError for anything unrecognized. Display names are deliberately rejected because a name cannot identify whose board it is.
Source
Thrown at clis/pinterest/utils.js:288
throw new CommandExecutionError(`Could not resolve board "${username}/${slug}" (does it exist and do you own it?)`);
}
return { boardId: String(boardId), board };
}
/**
* Resolve a board argument to { username, slug, path }, accepting a full board URL,
* <username>/<slug>, or a numeric board id (which BoardResource can look up directly).
* Display names are deliberately not accepted: a name cannot say whose board it is.
*/
export async function resolveBoardTarget(page, raw) {
const trimmed = String(raw ?? '').trim();
if (!trimmed) throw new ArgumentError('board is required', 'Pass <username>/<slug>, a board URL, or a numeric board id');
const direct = tryParseBoardRef(trimmed);
if (direct) return { ...direct, board: null };
if (!/^\d+$/.test(trimmed)) {
throw new ArgumentError(
`Not a board reference: "${trimmed}"`,
'Expected <username>/<slug>, a board URL, or a numeric board id (from `board-pins`/`user-boards`)',
);
}
await page.goto(`${PINTEREST_BASE}/`);
const { data: board } = await pinterestResourceFetch(
page,
'BoardResource',
{ board_id: trimmed, field_set_key: 'detailed' },
'/',
);
const url = board && board.url;
if (!url) {
throw new ArgumentError(`No board with id "${trimmed}"`, 'Check the id with `opencli pinterest user-boards <username>`');
}
const parts = decodeSegment(url).split('/').filter(Boolean);
if (parts.length < 2) {View on GitHub (pinned to 49907e53dc)
Solutions
- Use the full board URL copied from the browser, e.g. https://pinterest.com/username/slug/
- Or pass '<username>/<slug>' exactly as it appears in the board URL
- Or pass the numeric board id from board-pins/user-boards output
- Trim stray slashes/whitespace and remove query strings before passing
Example fix
// before
await cmd.boardPins({ board: 'Summer Recipes' });
// after
await cmd.boardPins({ board: 'alice/summer-recipes' }); Defensive patterns
Strategy: validation
Validate before calling
function looksLikeBoardRef(s){
const t = String(s ?? '').trim();
return /^https:\/\/(www\.)?pinterest\.com\/[^/]+\/[^/]+/.test(t) || /^[^/]+\/[^/]+$/.test(t) || /^\d+$/.test(t);
} Type guard
null
Try / catch
try { await cmd.boardPins({ board: raw }); } catch (e) { if (e instanceof ArgumentError && /Not a board reference/.test(e.message)) { console.error('Use username/slug, a board URL, or a numeric board id.'); } else throw e; } Prevention
- Never pass board display names — copy the URL instead
- Normalize inputs: trim, strip query strings and trailing slashes
- Prefer numeric board ids from board-pins/user-boards output for reliability
- Validate the input shape before calling the library
When it happens
Trigger: Passing a board display name ('Summer Recipes'), a slug without username ('summer-recipes'), a URL missing the board path, a string with more than one slash ('user/board/extra'), or a non-numeric id.
Common situations: Copying the board title from the UI instead of its URL; dropping the username half of user/slug; URL-encoded characters breaking the parse; trailing slashes or query strings confusing the parser.
Related errors
- Not a pin id or pin URL: "${raw}"
- ${raw}' does not look like a dianping shop id
- flomo memos --${name} must be a positive integer
- board is required
- ${name} must be${suffix} (got "${raw}")
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/0811fe89d3614363.
Report an issue: GitHub.