jackwener/OpenCLI · error · ArgumentError

Unknown privacy "${privacy}". Valid: ${PRIVACY.join(', ')}

Error message

Unknown privacy "${privacy}". Valid: ${PRIVACY.join(', ')}

What it means

The board-update command validates the --privacy argument against the PRIVACY whitelist (e.g. public/secret). Passing any other string raises ArgumentError before any request is made, so no board state is changed.

Source

Thrown at clis/pinterest/board-update.js:29

  access: 'write',
  description: 'Update the name, description, or privacy of your board',
  domain: 'www.pinterest.com',
  strategy: Strategy.COOKIE,
  args: [
    { name: 'board', type: 'string', positional: true, required: true, help: '<username>/<slug>, a board URL, or a numeric board id, e.g. janedoe/my-board' },
    { name: 'name', type: 'string', default: '', help: 'New board name' },
    { name: 'description', type: 'string', help: 'New board description (pass "" to clear)' },
    { name: 'privacy', type: 'string', choices: PRIVACY, help: 'New privacy: public or secret' },
  ],
  columns: ['boardId', 'name', 'privacy', 'url'],
  func: async (page, kwargs) => {
    const { username, slug, path, board: preloadedBoard } = await resolveBoardTarget(page, kwargs.board);
    const name = String(kwargs.name ?? '').trim();
    const description = kwargs.description === undefined ? undefined : String(kwargs.description).trim();
    const privacy = String(kwargs.privacy ?? '').trim();

    if (privacy && !PRIVACY.includes(privacy)) {
      throw new ArgumentError(`Unknown privacy "${privacy}". Valid: ${PRIVACY.join(', ')}`);
    }
    if (!name && description === undefined && !privacy) {
      throw new ArgumentError(
        'nothing to update',
        'Pass at least one of --name, --description, or --privacy',
      );
    }

    await page.goto(`${PINTEREST_BASE}${path}`);
    const { boardId } = await resolveBoardId(page, username, slug, path, preloadedBoard);

    const options = { board_id: boardId };
    if (name) options.name = name;
    if (description !== undefined) options.description = description;
    if (privacy) options.privacy = privacy;

    const updated = await pinterestResourceUpdate(page, 'BoardResource', options, path);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Use one of the valid values listed in the error message exactly (check casing).
  2. Replace 'private' with 'secret' (Pinterest's term for hidden boards).
  3. Omit --privacy entirely if you only want to update name or description.
  4. Validate the value against PRIVACY in your script before invoking the command.

Example fix

// before
await cli.boardUpdate('user/board', { privacy: 'private' });
// after
await cli.boardUpdate('user/board', { privacy: 'secret' });
Defensive patterns

Strategy: validation

Validate before calling

const PRIVACY = ['public', 'secret'];
if (privacy !== undefined && !PRIVACY.includes(privacy)) {
  throw new Error(`privacy must be one of ${PRIVACY.join(', ')}, got ${privacy}`);
}

Type guard

function isValidPrivacy(v) {
  return typeof v === 'string' && ['public', 'secret'].includes(v);
}

Try / catch

try {
  await cli.boardUpdate(board, { privacy });
} catch (e) {
  if (/Unknown privacy/.test(e.message)) {
    console.error('Use exactly:', e.message.split('Valid:')[1].trim());
  } else throw e;
}

Prevention

When it happens

Trigger: Running `pinterest board-update <board> --privacy <value>` where value is not exactly one of the PRIVACY entries — e.g. 'private' instead of 'secret', 'Public' with wrong casing, or a truncated value.

Common situations: Confusing Pinterest's 'secret' terminology with 'private'; case-sensitivity mistakes in scripts; older scripts using vocabulary from another API.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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