jackwener/OpenCLI · error · ArgumentError

--section requires --board

Error message

--section requires --board

What it means

Thrown in clis/pinterest/pin-update.js:40 when --section is provided without --board. Board sections always belong to a specific board, so the command cannot resolve a section id without knowing the target board, and it fails fast before any API call.

Source

Thrown at clis/pinterest/pin-update.js:40

    { name: 'section', type: 'string', default: '', help: 'Move the pin to this board section id or slug (requires --board)' },
  ],
  columns: ['pinId', 'title', 'board', 'url'],
  func: async (page, kwargs) => {
    const id = parsePinId(kwargs.pin);
    const title = String(kwargs.title ?? '').trim();
    const description = kwargs.description === undefined ? undefined : String(kwargs.description).trim();
    const link = kwargs.link === undefined ? undefined : String(kwargs.link).trim();
    const boardRef = String(kwargs.board ?? '').trim();
    const section = String(kwargs.section ?? '').trim();

    if (!title && description === undefined && link === undefined && !boardRef) {
      throw new ArgumentError(
        'nothing to update',
        'Pass at least one of --title, --description, --link, or --board',
      );
    }
    if (section && !boardRef) {
      throw new ArgumentError('--section requires --board', 'Sections belong to a board, so pass --board too');
    }

    const options = { id };
    let sourceUrl = `/pin/${id}/`;

    if (boardRef) {
      const { username, slug, path, board: preloadedBoard } = await resolveBoardTarget(page, boardRef);
      await page.goto(`${PINTEREST_BASE}${path}`);
      const { boardId } = await resolveBoardId(page, username, slug, path, preloadedBoard);
      options.board_id = boardId;
      // PinResource/update is the only endpoint that honours a section, and only under this key.
      if (section) options.board_section_id = (await resolveSection(page, boardId, section, path)).sectionId;
      sourceUrl = path;
    } else {
      await page.goto(`${PINTEREST_BASE}${sourceUrl}`);
    }

    if (title) options.title = title;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Add --board to the same command: `pin-update <id> --board <user>/<slug> --section <section>`
  2. If you only want the section and the pin already lives on the right board, still pass that board's reference explicitly
  3. If you didn't mean to move sections, remove the stray --section flag

Example fix

// before
$ opencli pinterest pin-update 1234567890 --section recipes
// after
$ opencli pinterest pin-update 1234567890 --board me/cooking --section recipes
Defensive patterns

Strategy: validation

Validate before calling

if (section && !board) {
  throw new Error('--section requires --board: sections belong to a board');
}

Try / catch

try {
  await run(['pin-update', pinId, '--board', board, '--section', section]);
} catch (e) {
  if (/--section requires --board/.test(e.message)) {
    throw new Error('Pass the parent board with --board alongside --section');
  }
  throw e;
}

Prevention

When it happens

Trigger: `pin-update <id> --section <name-or-id>` with no --board argument, so `section` is truthy while `boardRef` is empty.

Common situations: Assuming the pin's current board is inferred automatically; copying a section-only command from docs; scripts that conditionally pass --board but always pass --section.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/b74bc620f87162cd. Report an issue: GitHub.