{"record":{"id":"bfe3ec833c3936a9","repo":"jackwener/OpenCLI","slug":"section-creation-did-not-return-a-section-id","errorCode":null,"errorMessage":"Section creation did not return a section id","messagePattern":"Section creation did not return a section id","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/board-section-create.js","lineNumber":35,"sourceCode":"  columns: ['sectionId', 'title', 'slug', 'board', 'url'],\n  func: async (page, kwargs) => {\n    const { username, slug, path, board: preloadedBoard } = await resolveBoardTarget(page, kwargs.board);\n    const title = String(kwargs.title ?? '').trim();\n    if (!title) throw new ArgumentError('section title is required');\n\n    await page.goto(`${PINTEREST_BASE}${path}`);\n    const { boardId } = await resolveBoardId(page, username, slug, path, preloadedBoard);\n\n    // The section title goes in `name` here (a `title` key is rejected as a missing parameter).\n    const created = await pinterestResourceCreate(\n      page,\n      'BoardSectionResource',\n      { board_id: boardId, name: title },\n      path,\n    );\n    const sectionId = created && created.id;\n    if (!sectionId) {\n      throw new CommandExecutionError('Section creation did not return a section id');\n    }\n\n    return [{\n      sectionId: String(sectionId),\n      title: created.title || created.name || title,\n      slug: created.slug || '',\n      board: `${username}/${slug}`,\n      url: created.slug ? `${PINTEREST_BASE}${path}${created.slug}/` : '',\n    }];\n  },\n});\n","sourceCodeStart":17,"sourceCodeEnd":47,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/board-section-create.js#L17-L47","documentation":"This CommandExecutionError is thrown when Pinterest's section-create resource call (`pinterestResourceCreate` on 'BoardSectionResource') completes without throwing but the response lacks an `id`. The library treats a section response without `id` as a failed/unusable creation and aborts so callers never receive a row with a bogus or missing sectionId. It usually indicates an unexpected API response shape — a degenerate error body, a wrapped payload, or a Pinterest API schema change.","triggerScenarios":"The v3 `BoardSectionResource` create returns an object without `id` (e.g. `{ ok: false }` or a wrapped `{ data: {...} }` payload after an API change); the page session is logged-out or rate-limited so the mutation no-ops with an HTTP-200 error body; the board is deleted concurrently mid-call.","commonSituations":"Pinterest shipping an API/DOM change that renames or nests the id field; expired sessions in long-running automation; transient Pinterest-side failures returning error bodies with status 200.","solutions":["Log the raw `created` payload (debug print before the check) to see what the API actually returned","Re-authenticate / refresh the page session — an expired session often yields degenerate payloads","Check for a Pinterest API/DOM schema change and update resource parsing to the new id field location","Retry once; if it reproduces, catch CommandExecutionError and re-list sections to verify whether the section was actually created"],"exampleFix":"// before\nconst created = await pinterestResourceCreate(page, 'BoardSectionResource', { board_id: boardId, name: title }, path);\n// after\nconst created = await pinterestResourceCreate(page, 'BoardSectionResource', { board_id: boardId, name: title }, path);\nconsole.error('create response:', JSON.stringify(created)); // debug payload shape\nif (!created?.id) throw new CommandExecutionError('Section creation did not return a section id');","handlingStrategy":"type-guard","validationCode":"// after the create call, before using the result:\nconst sectionId = created && created.id;\nif (!sectionId) {\n  console.error('unexpected create payload:', JSON.stringify(created));\n}","typeGuard":"function hasSectionId(created) {\n  return created != null &&\n    typeof created === 'object' &&\n    (typeof created.id === 'string' || typeof created.id === 'number') &&\n    String(created.id).length > 0;\n}","tryCatchPattern":"try {\n  const row = await boardSectionCreate({ board, title });\n} catch (err) {\n  if (err instanceof CommandExecutionError && /did not return a section id/.test(err.message)) {\n    const sections = await boardSections(board); // verify whether it was actually created\n    const match = sections.find(s => s.title === title);\n    if (!match) throw err;\n    return match;\n  }\n  throw err;\n}","preventionTips":["Log raw API payloads in dev to detect schema changes early","Re-authenticate sessions before long-running automation","Wrap create-then-verify: after create, list sections and confirm presence","Watch for Pinterest API/DOM changes if you rely on v3 resource endpoints"],"tags":["pinterest","api-response","unexpected-payload"],"backgroundTag":"unexpected-api-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}