{"record":{"id":"fc0e0b327a260a39","repo":"diegosouzapw/OmniRoute","slug":"errbody-error-message-post-api-quota-pools","errorCode":null,"errorMessage":"errBody?.error?.message || `POST /api/quota/pools failed: HTTP ${createRes.status}`","messagePattern":"errBody\\?\\.error\\?\\.message \\|\\| `POST /api/quota/pools failed: HTTP (.+?)`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/app/(dashboard)/dashboard/costs/quota-share/components/PoolWizard.tsx","lineNumber":457,"sourceCode":"    try {\n      if (!editPool) {\n        // ── Create mode: POST → optional PUT → PATCH ──────────────────────\n\n        // 1. POST /api/quota/pools → get new pool id\n        const createRes = await fetch(\"/api/quota/pools\", {\n          method: \"POST\",\n          headers: { \"Content-Type\": \"application/json\" },\n          body: JSON.stringify({\n            connectionId: primaryConnectionId,\n            connectionIds,\n            name: effectivePoolName,\n            allocations: [],\n            groupId: resolvedGroupId,\n          }),\n        });\n        if (!createRes.ok) {\n          const errBody = await createRes.json().catch(() => null);\n          throw new Error(\n            errBody?.error?.message || `POST /api/quota/pools failed: HTTP ${createRes.status}`\n          );\n        }\n        const createData = (await createRes.json()) as { pool: { id: string } };\n        const newPoolId = createData.pool.id;\n\n        // 2. PUT /api/quota/plans/[primaryConnectionId] — only when user edited dimensions\n        if (dimensionsEdited && editDimensions.length > 0) {\n          const planRes = await fetch(`/api/quota/plans/${primaryConnectionId}`, {\n            method: \"PUT\",\n            headers: { \"Content-Type\": \"application/json\" },\n            body: JSON.stringify({ dimensions: editDimensions }),\n          });\n          if (!planRes.ok) {\n            const errBody = await planRes.json().catch(() => null);\n            throw new Error(\n              errBody?.error?.message || `PUT /api/quota/plans failed: HTTP ${planRes.status}`\n            );","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/(dashboard)/dashboard/costs/quota-share/components/PoolWizard.tsx#L439-L475","documentation":"Error \"errBody?.error?.message || `POST /api/quota/pools failed: HTTP ${createRes.status}`\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/app/(dashboard)/dashboard/costs/quota-share/components/PoolWizard.tsx:457 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}