{"record":{"id":"0811fe89d3614363","repo":"jackwener/OpenCLI","slug":"not-a-board-reference-trimmed","errorCode":null,"errorMessage":"Not a board reference: \"${trimmed}\"","messagePattern":"Not a board reference: \"(.+?)\"","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/utils.js","lineNumber":288,"sourceCode":"    throw new CommandExecutionError(`Could not resolve board \"${username}/${slug}\" (does it exist and do you own it?)`);\n  }\n  return { boardId: String(boardId), board };\n}\n\n/**\n * Resolve a board argument to { username, slug, path }, accepting a full board URL,\n * <username>/<slug>, or a numeric board id (which BoardResource can look up directly).\n * Display names are deliberately not accepted: a name cannot say whose board it is.\n */\nexport async function resolveBoardTarget(page, raw) {\n  const trimmed = String(raw ?? '').trim();\n  if (!trimmed) throw new ArgumentError('board is required', 'Pass <username>/<slug>, a board URL, or a numeric board id');\n\n  const direct = tryParseBoardRef(trimmed);\n  if (direct) return { ...direct, board: null };\n\n  if (!/^\\d+$/.test(trimmed)) {\n    throw new ArgumentError(\n      `Not a board reference: \"${trimmed}\"`,\n      'Expected <username>/<slug>, a board URL, or a numeric board id (from `board-pins`/`user-boards`)',\n    );\n  }\n\n  await page.goto(`${PINTEREST_BASE}/`);\n  const { data: board } = await pinterestResourceFetch(\n    page,\n    'BoardResource',\n    { board_id: trimmed, field_set_key: 'detailed' },\n    '/',\n  );\n  const url = board && board.url;\n  if (!url) {\n    throw new ArgumentError(`No board with id \"${trimmed}\"`, 'Check the id with `opencli pinterest user-boards <username>`');\n  }\n  const parts = decodeSegment(url).split('/').filter(Boolean);\n  if (parts.length < 2) {","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/utils.js#L270-L306","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait cmd.boardPins({ board: 'Summer Recipes' });\n// after\nawait cmd.boardPins({ board: 'alice/summer-recipes' });","handlingStrategy":"validation","validationCode":"function looksLikeBoardRef(s){\n  const t = String(s ?? '').trim();\n  return /^https:\\/\\/(www\\.)?pinterest\\.com\\/[^/]+\\/[^/]+/.test(t) || /^[^/]+\\/[^/]+$/.test(t) || /^\\d+$/.test(t);\n}","typeGuard":"null","tryCatchPattern":"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; }","preventionTips":["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"],"tags":["argument-validation","input-parsing","pinterest"],"backgroundTag":"invalid-argument-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}