{"record":{"id":"f2538e85f809db90","repo":"garrytan/gstack","slug":"api-error-response-status-error-slice-0-3","errorCode":null,"errorMessage":"API error (${response.status}): ${error.slice(0, 300)}","messagePattern":"API error \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"design/src/evolve.ts","lineNumber":81,"sourceCode":"      },\n      body: JSON.stringify({\n        model: \"gpt-4o\",\n        input: evolvedPrompt,\n        tools: [{ type: \"image_generation\", model: \"gpt-image-2\", size: \"1536x1024\", quality: \"high\" }],\n      }),\n      signal: controller.signal,\n    });\n\n    if (!response.ok) {\n      const error = await response.text();\n      if (response.status === 403 && error.includes(\"organization must be verified\")) {\n        throw new Error(\n          \"OpenAI organization verification required.\\n\"\n          + \"Go to https://platform.openai.com/settings/organization to verify.\\n\"\n          + \"After verification, wait up to 15 minutes for access to propagate.\",\n        );\n      }\n      throw new Error(`API error (${response.status}): ${error.slice(0, 300)}`);\n    }\n\n    const data = await response.json() as any;\n    const imageItem = data.output?.find((item: any) => item.type === \"image_generation_call\");\n\n    if (!imageItem?.result) {\n      throw new Error(\"No image data in response\");\n    }\n\n    fs.mkdirSync(path.dirname(options.output), { recursive: true });\n    const imageBuffer = Buffer.from(imageItem.result, \"base64\");\n    fs.writeFileSync(options.output, imageBuffer);\n\n    const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);\n    console.error(`Generated (${elapsed}s, ${(imageBuffer.length / 1024).toFixed(0)}KB) → ${options.output}`);\n\n    console.log(JSON.stringify({\n      outputPath: options.output,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/design/src/evolve.ts#L63-L99","documentation":"Error \"API error (${response.status}): ${error.slice(0, 300)}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at design/src/evolve.ts:81 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"}