{"record":{"id":"40344b8d38a56af2","repo":"jackwener/OpenCLI","slug":"section-requires-board-40344b","errorCode":null,"errorMessage":"--section requires --board","messagePattern":"--section requires --board","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/save.js","lineNumber":24,"sourceCode":"cli({\n  site: 'pinterest',\n  name: 'save',\n  access: 'write',\n  description: 'Save a pin to your profile or a board',\n  domain: 'www.pinterest.com',\n  strategy: Strategy.COOKIE,\n  args: [\n    { name: 'pin', type: 'string', positional: true, required: true, help: 'Pin id or pin URL to repin, e.g. 1234567890123456' },\n    { name: 'board', type: 'string', help: 'Target board: <username>/<slug>, board URL, or board id (omit to save to your profile)' },\n    { name: 'section', type: 'string', default: '', help: 'Optional board section id or slug (requires --board)' },\n  ],\n  columns: ['pinId', 'sourcePinId', 'board', 'url'],\n  func: async (page, kwargs) => {\n    const sourcePinId = parsePinId(kwargs.pin);\n    const boardRef = String(kwargs.board ?? '').trim();\n    const section = String(kwargs.section ?? '').trim();\n    if (section && !boardRef) {\n      throw new ArgumentError('--section requires --board', 'Sections belong to a board, so pass --board too');\n    }\n\n    const options = { pin_id: sourcePinId };\n    let sourceUrl = '/';\n    let sectionId = '';\n\n    if (boardRef) {\n      const { username, slug, path, board } = await resolveBoardTarget(page, boardRef);\n      await page.goto(`${PINTEREST_BASE}${path}`);\n\n      const { boardId } = await resolveBoardId(page, username, slug, path, board);\n      options.board_id = boardId;\n      sourceUrl = path;\n      // Validate --section before repinning, so a bad value fails before anything is created.\n      if (section) sectionId = (await resolveSection(page, options.board_id, section, path)).sectionId;\n    } else {\n      // No board given: Pinterest routes a boardless repin to the profile's Quick Saves board.\n      await page.goto(`${PINTEREST_BASE}/`);","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/save.js#L6-L42","documentation":"Thrown in clis/pinterest/save.js:24 when a repin (save) specifies --section without --board. A section exists only within a board, so the command cannot determine which board's section to use and rejects the arguments before any API interaction.","triggerScenarios":"`save --pin <sourcePinId> --section <name-or-id>` with no --board flag, making `section` truthy while `boardRef` is empty.","commonSituations":"Assuming the source pin's original board implies the section; partial flag forwarding from scripts; documentation examples trimmed down that dropped --board.","solutions":["Pass both flags: `save --pin <id> --board <user>/<slug> --section <section>`","Resolve the section's parent board and pass it explicitly — sections are never global","If you meant to save to the board generally, drop --section or pick a valid section of the given board"],"exampleFix":"// before\n$ opencli pinterest save --pin 999 --section inspiration\n// after\n$ opencli pinterest save --pin 999 --board me/inspo --section inspiration","handlingStrategy":"validation","validationCode":"if (section && !board) {\n  throw new Error('save: --section requires --board (sections belong to a board)');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await run(['save', '--pin', pinId, '--board', board, '--section', section]);\n} catch (e) {\n  if (/--section requires --board/.test(e.message)) {\n    throw new Error('Provide the section\\'s parent board via --board');\n  }\n  throw e;\n}","preventionTips":["Always pair --board with --section in save commands","Store board and section together in config objects so one can't be passed alone","Validate flag pairs before spawning the command in scripts"],"tags":["validation","argument-error","pinterest","dependent-flags"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}