{"record":{"id":"8d5b5a2b19f960f7","repo":"diegosouzapw/OmniRoute","slug":"chatgpt-web-returns-one-image-per-chat-turn-reque","errorCode":null,"errorMessage":"ChatGPT Web returns one image per chat turn; requested n=${requestedCount} will run sequentially","messagePattern":"ChatGPT Web returns one image per chat turn; requested n=(.+?) will run sequentially","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"open-sse/handlers/imageGeneration/providers/chatgptWeb.ts","lineNumber":88,"sourceCode":"  }\n\n  // Each image is one chatgpt.com chat turn (~30s). Cap at 4 (matches OpenAI's\n  // own limit for GPT Image models) so a stray n=1000 doesn't pin the\n  // executor for hours before the upstream HTTP timeout fires.\n  const CHATGPT_WEB_IMAGE_N_MAX = 4;\n  const rawCount = Number.isInteger(body.n) && (body.n as number) > 0 ? (body.n as number) : 1;\n  if (rawCount > CHATGPT_WEB_IMAGE_N_MAX) {\n    return saveImageErrorResult({\n      provider,\n      model,\n      status: 400,\n      startTime,\n      error: `ChatGPT Web image generation supports n=1..${CHATGPT_WEB_IMAGE_N_MAX} (got ${rawCount}); each n is a separate ~30s chat turn.`,\n    });\n  }\n  const requestedCount = rawCount;\n  if (log && requestedCount > 1) {\n    log.warn(\n      \"IMAGE\",\n      `ChatGPT Web returns one image per chat turn; requested n=${requestedCount} will run sequentially`\n    );\n  }\n\n  const wantsBase64 = body.response_format === \"b64_json\";\n  const images: Array<{ url?: string; b64_json?: string }> = [];\n  const requestBody = {\n    model,\n    prompt: prompt.slice(0, 500),\n    size: body.size || undefined,\n    quality: body.quality || undefined,\n  };\n\n  for (let i = 0; i < requestedCount; i++) {\n    const executor = executorFactory();\n    const result = await executor.execute({\n      model,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/handlers/imageGeneration/providers/chatgptWeb.ts#L70-L106","documentation":"Error \"ChatGPT Web returns one image per chat turn; requested n=${requestedCount} will run sequentially\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/handlers/imageGeneration/providers/chatgptWeb.ts:88 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"}