jackwener/OpenCLI · error · ArgumentError
No section matching " " on this board
Error message
No section matching "${wanted}" on this board What it means
resolveSection matches a --section value against the board's sections by exact id, then by case/punctuation-folded slug. If no section matches, it throws this ArgumentError listing the available slugs and ids. Pinterest itself ignores unknown sections silently, so the CLI fails explicitly here instead.
Solutions
- Use one of the slugs/ids listed in the error's available list.
- Run `opencli pinterest board-sections <board>` to see current section slugs and ids.
- Recreate the section with `board-section-create` if it was deleted or renamed.
- Confirm the --board argument points at the board that actually contains the section.
Example fix
// before --section "My Desserts!" # slug is actually 'my-desserts' // after --section my-desserts
Defensive patterns
Strategy: validation
Validate before calling
const { results } = await fetchSections(board);
const wanted = String(section).trim().toLowerCase();
if (!results.some(s => String(s.id) === wanted || String(s.slug || '').toLowerCase() === wanted)) {
throw new Error(`Section "${section}" not on ${board}. Available: ${results.map(s => s.slug).join(', ')}`);
} Try / catch
try {
await pinToSection(board, section);
} catch (err) {
if (String(err.message).includes('No section matching')) {
// list sections and prompt/pick the closest slug
const sections = await listBoardSections(board);
// choose from sections and retry
} else throw err;
} Prevention
- Always copy section slugs from `board-sections` output rather than typing titles.
- Re-validate section slugs after any manual board reorganization.
- Normalize case/punctuation yourself before passing --section values.
When it happens
Trigger: `--section` value is neither a section id nor a (folded) slug of any existing section on that board — typo, wrong case that folding doesn't cover, section renamed/deleted, or section belongs to a different board.
Common situations: Section was renamed after a script hardcoded the old slug; slug contains characters normalizeForMatch doesn't fold; passing the section title when the API's slug differs; using a section from another board.
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
- Board has no sections, so --section
- No board with id
- Could not resolve board
- Could not resolve pin
- Pin was created but could not be moved into section
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4dbcebd7c4eda569.
Report an issue: GitHub.
Appendix: source
Thrown at clis/pinterest/utils.js:330
/**
* 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) {
try {
await pinterestResourceUpdate(
page,
'PinResource',
{ id: String(pinId), board_id: String(boardId), board_section_id: String(sectionId) },
sourceUrl,
);View on GitHub (pinned to 49907e53dc)