diegosouzapw/OmniRoute · error
Gemini Web returns image(s) per chat turn; requested n=
Error message
Gemini Web returns image(s) per chat turn; requested n=${requestedCount} will run sequentially What it means
Informational notice: Gemini Web returns images per chat turn, and the request asked for n>1 (within GEMINI_WEB_IMAGE_N_MAX). Each image requires a separate ~30-60s web turn executed sequentially — total latency scales with n. Logged so operators understand why multi-image requests are slow, not a failure.
Solutions
- No fix required — sequential turns are automatic
- Reduce n to lower end-to-end latency
- Use a native Gemini API connection for faster multi-image generation
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at open-sse/handlers/imageGeneration/providers/geminiWeb.ts:127 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/ba82b0f4109f1a0c.
Report an issue: GitHub.
Appendix: source
Thrown at open-sse/handlers/imageGeneration/providers/geminiWeb.ts:127
status: 401,
startTime,
error: "Gemini Web credentials missing session cookie",
});
}
const rawCount = Number.isInteger(body.n) && (body.n as number) > 0 ? (body.n as number) : 1;
if (rawCount > GEMINI_WEB_IMAGE_N_MAX) {
return saveImageErrorResult({
provider,
model,
status: 400,
startTime,
error: `Gemini Web image generation supports n=1..${GEMINI_WEB_IMAGE_N_MAX} (got ${rawCount}); each n is a separate ~30-60s web turn.`,
});
}
const requestedCount = rawCount;
if (log && requestedCount > 1) {
log.warn(
"IMAGE",
`Gemini Web returns image(s) per chat turn; requested n=${requestedCount} will run sequentially`
);
}
const wantsBase64 = body.response_format === "b64_json";
const images: Array<{ url?: string; b64_json?: string }> = [];
const requestBody = {
model,
prompt: prompt.slice(0, 500),
size: body.size || undefined,
n: requestedCount,
};
for (let i = 0; i < requestedCount; i++) {
const executor = executorFactory();
const result = await executor.execute({
model,View on GitHub (pinned to a179ffed5b)