{"record":{"id":"a45459edc2348df0","repo":"garrytan/gstack","slug":"api-error-response-status-error-slice-0-2","errorCode":null,"errorMessage":"API error (${response.status}): ${error.slice(0, 200)}","messagePattern":"API error \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"design/src/design-to-code.ts","lineNumber":79,"sourceCode":"  \"colors\": [\"#hex - usage\", ...],\n  \"typography\": [\"role: family, size, weight\", ...],\n  \"layout\": [\"description of layout pattern\", ...],\n  \"components\": [\"component name - description\", ...]\n}\n\nBe specific about every visual detail: exact hex colors, font sizes in px, spacing values, border-radius, shadows. The developer should be able to implement this without looking at the mockup again.${contextBlock}`,\n            },\n          ],\n        }],\n        max_tokens: 1000,\n        response_format: { type: \"json_object\" },\n      }),\n      signal: controller.signal,\n    });\n\n    if (!response.ok) {\n      const error = await response.text();\n      throw new Error(`API error (${response.status}): ${error.slice(0, 200)}`);\n    }\n\n    const data = await response.json() as any;\n    const content = data.choices?.[0]?.message?.content?.trim() || \"\";\n    return JSON.parse(content) as DesignToCodeResult;\n  } finally {\n    clearTimeout(timeout);\n  }\n}\n","sourceCodeStart":61,"sourceCodeEnd":89,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/design/src/design-to-code.ts#L61-L89","documentation":"Error \"API error (${response.status}): ${error.slice(0, 200)}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at design/src/design-to-code.ts:79 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":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}