{"record":{"id":"6d085bcd837afffe","repo":"jackwener/OpenCLI","slug":"board-is-required","errorCode":null,"errorMessage":"board is required","messagePattern":"board is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/utils.js","lineNumber":282,"sourceCode":"export async function resolveBoardId(page, username, slug, path, preloaded = null) {\n  const board = preloaded && preloaded.id\n    ? preloaded\n    : (await pinterestResourceFetch(page, 'BoardResource', { username, slug, field_set_key: 'detailed' }, path)).data;\n  const boardId = board && board.id;\n  if (!boardId) {\n    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  );","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/utils.js#L264-L300","documentation":"resolveBoardTarget requires a non-empty board argument. Empty, null, or whitespace-only input throws ArgumentError, because there is no way to identify which board to operate on.","triggerScenarios":"Passing an empty string, null, or undefined as the board option, e.g. { board: '' } or omitting --board on the CLI when the command requires it; a variable that failed to populate before the call.","commonSituations":"Shell variable unset ($BOARD empty); config file missing the board key; CLI flag typo so the flag value never binds; template interpolation producing an empty string.","solutions":["Pass a board argument: <username>/<slug>, a board URL, or a numeric board id","Check the shell/config variable actually holds a value before calling","On CLI, include the --board flag with a value","Run user-boards to find the correct board reference"],"exampleFix":"// before\nconst board = process.env.BOARD || '';\nawait cmd.createPin({ board, ... }); // throws\n// after\nif (!process.env.BOARD) throw new Error('BOARD env var required');\nawait cmd.createPin({ board: process.env.BOARD, ... });","handlingStrategy":"validation","validationCode":"function requireBoardArg(v){ if (v == null || String(v).trim() === '') throw new Error('board is required: pass <username>/<slug>, a board URL, or a numeric id'); return String(v).trim(); }","typeGuard":"null","tryCatchPattern":"try { await cmd.createPin(args); } catch (e) { if (e instanceof ArgumentError && /board is required/.test(e.message)) { console.error('Supply --board <username>/<slug> or a board URL.'); } else throw e; }","preventionTips":["Check env/config variables are populated before invoking commands","Include the --board flag whenever the command requires it","Fail fast on empty strings at your app's config-loading stage","Keep a default board reference in your scripts"],"tags":["argument-validation","missing-argument","pinterest"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}