jackwener/OpenCLI · error · ArgumentError
Board has no sections, so --section "${wanted}" cannot be us
Error message
Board has no sections, so --section "${wanted}" cannot be used What it means
resolveSection fetches a board's sections via BoardSectionsResource before matching a --section value. If the board has zero sections at all, no --section value can match, so it throws this ArgumentError telling the user to create a section first.
Source
Thrown at clis/pinterest/utils.js:323
const parts = decodeSegment(url).split('/').filter(Boolean);
if (parts.length < 2) {
throw new CommandExecutionError(`Board ${trimmed} returned an unusable url: ${url}`);
}
// Hand the fetched board back so callers do not re-request what we already have.
return { username: parts[0], slug: parts[1], path: `/${parts[0]}/${parts[1]}/`, board };
}
/**
* Resolve a --section value against the board's real sections, accepting an id or a slug.
* Pinterest ignores an unknown section silently, so an unmatched value must fail here.
* Returns { sectionId, title, slug }.
*/
export async function resolveSection(page, boardId, sectionValue, sourceUrl) {
const wanted = String(sectionValue ?? '').trim();
const { results } = await pinterestResourceFetch(page, 'BoardSectionsResource', { board_id: String(boardId) }, sourceUrl);
const sections = results.filter((section) => section && section.id);
if (sections.length === 0) {
throw new ArgumentError(`Board has no sections, so --section "${wanted}" cannot be used`, 'Create one first with `opencli pinterest board-section-create`');
}
const folded = normalizeForMatch(wanted);
const match = sections.find((section) => String(section.id) === wanted)
|| sections.find((section) => normalizeForMatch(section.slug) === folded);
if (!match) {
const available = sections.map((section) => `${section.slug || '(no slug)'} (${section.id})`).join(', ');
throw new ArgumentError(`No section matching "${wanted}" on this board`, `Pass a section slug or id — available: ${available}`);
}
return { sectionId: String(match.id), title: (match.title || '').trim(), slug: match.slug || '' };
}
/**
* Move an existing pin into a board section.
* The create endpoints (PinResource/create, RepinResource/create) accept a section key, answer
* HTTP 200, and file the pin at the board root anyway — only PinResource/update honours it. So
* callers that create a pin have to follow up with this second request.
*/
export async function movePinToSection(page, pinId, boardId, sectionId, sourceUrl) {View on GitHub (pinned to 49907e53dc)
Solutions
- Create a section with `opencli pinterest board-section-create` and retry.
- Drop the `--section` flag to place the pin at the board root instead.
- Verify you targeted the intended board — run `opencli pinterest board-sections <board>` to list its sections.
Example fix
// before opencli pinterest pin-create --board someuser/recipes --section Desserts ... // after opencli pinterest board-section-create --board someuser/recipes --title Desserts opencli pinterest pin-create --board someuser/recipes --section Desserts ...
Defensive patterns
Strategy: validation
Validate before calling
const sections = await runCmd(['opencli', 'pinterest', 'board-sections', board]);
if (!sections.length && wantedSection) {
await runCmd(['opencli', 'pinterest', 'board-section-create', '--board', board, '--title', wantedSection]);
} Try / catch
try {
await pinToBoard({ board, section });
} catch (err) {
if (String(err.message).includes('Board has no sections')) {
await pinToBoard({ board }); // place at board root instead
} else throw err;
} Prevention
- Call `board-sections <board>` before any scripted pin-to-section operation.
- Create required sections idempotently (create-if-missing) at script start.
- Make --section optional in your scripts and fall back to board root.
When it happens
Trigger: Running a command with `--section <name>` against a board that has never had any board sections created (BoardSectionsResource returns an empty results list).
Common situations: Scripting a pin-to-section move against a fresh/default board; assuming a board has sections because the UI shows folders elsewhere; wrong board id passed so a different, section-less board is queried.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No section matching "${wanted}" on this board
- No board with id "${trimmed}"
- Pin ${pinId} was created but could not be moved into section
- bbc topic "${args.topic}" is not supported
- bbc ${label} must be a positive integer
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1522607b2e668ae4.
Report an issue: GitHub.