{"record":{"id":"4dbcebd7c4eda569","repo":"jackwener/OpenCLI","slug":"no-section-matching-wanted-on-this-board","errorCode":null,"errorMessage":"No section matching \"${wanted}\" on this board","messagePattern":"No section matching \"(.+?)\" on this board","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/utils.js","lineNumber":330,"sourceCode":"\n/**\n * Resolve a --section value against the board's real sections, accepting an id or a slug.\n * Pinterest ignores an unknown section silently, so an unmatched value must fail here.\n * Returns { sectionId, title, slug }.\n */\nexport async function resolveSection(page, boardId, sectionValue, sourceUrl) {\n  const wanted = String(sectionValue ?? '').trim();\n  const { results } = await pinterestResourceFetch(page, 'BoardSectionsResource', { board_id: String(boardId) }, sourceUrl);\n  const sections = results.filter((section) => section && section.id);\n  if (sections.length === 0) {\n    throw new ArgumentError(`Board has no sections, so --section \"${wanted}\" cannot be used`, 'Create one first with `opencli pinterest board-section-create`');\n  }\n  const folded = normalizeForMatch(wanted);\n  const match = sections.find((section) => String(section.id) === wanted)\n    || sections.find((section) => normalizeForMatch(section.slug) === folded);\n  if (!match) {\n    const available = sections.map((section) => `${section.slug || '(no slug)'} (${section.id})`).join(', ');\n    throw new ArgumentError(`No section matching \"${wanted}\" on this board`, `Pass a section slug or id — available: ${available}`);\n  }\n  return { sectionId: String(match.id), title: (match.title || '').trim(), slug: match.slug || '' };\n}\n\n/**\n * Move an existing pin into a board section.\n * The create endpoints (PinResource/create, RepinResource/create) accept a section key, answer\n * HTTP 200, and file the pin at the board root anyway — only PinResource/update honours it. So\n * callers that create a pin have to follow up with this second request.\n */\nexport async function movePinToSection(page, pinId, boardId, sectionId, sourceUrl) {\n  try {\n    await pinterestResourceUpdate(\n      page,\n      'PinResource',\n      { id: String(pinId), board_id: String(boardId), board_section_id: String(sectionId) },\n      sourceUrl,\n    );","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/utils.js#L312-L348","documentation":"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.","triggerScenarios":"`--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.","commonSituations":"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.","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."],"exampleFix":"// before\n--section \"My Desserts!\"   # slug is actually 'my-desserts'\n// after\n--section my-desserts","handlingStrategy":"validation","validationCode":"const { results } = await fetchSections(board);\nconst wanted = String(section).trim().toLowerCase();\nif (!results.some(s => String(s.id) === wanted || String(s.slug || '').toLowerCase() === wanted)) {\n  throw new Error(`Section \"${section}\" not on ${board}. Available: ${results.map(s => s.slug).join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await pinToSection(board, section);\n} catch (err) {\n  if (String(err.message).includes('No section matching')) {\n    // list sections and prompt/pick the closest slug\n    const sections = await listBoardSections(board);\n    // choose from sections and retry\n  } else throw err;\n}","preventionTips":["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."],"tags":["pinterest","argument","section","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}