jackwener/OpenCLI · error · EmptyResultError
'gemini image',`No generated image was detected. Open ${link
Error message
'gemini image',`No generated image was detected. Open ${link} and check whether Gemini produced one.` What it means
After sending the image prompt, gemini image waits for new image URLs (waitForGeminiImages) within the given timeout; if none appear it throws EmptyResultError including the conversation link so the user can inspect the chat manually. This distinguishes 'Gemini did not produce an image' from command crashes, e.g. when Gemini responds with text only or refuses the request.
Source
Thrown at clis/gemini/image.js:100
const timeout = kwargs.timeout;
if (!Number.isInteger(timeout) || timeout < 1) {
throw new ArgumentError('--timeout must be a positive integer (seconds)');
}
const startFresh = true;
const skipDownloadRaw = kwargs.sd;
const skipDownload = skipDownloadRaw === '' || skipDownloadRaw === true || normalizeBooleanFlag(skipDownloadRaw);
const effectivePrompt = buildImagePrompt(prompt, {
ratio,
style: style || undefined,
});
if (startFresh)
await startNewGeminiChat(page);
const beforeUrls = await getGeminiVisibleImageUrls(page);
await sendGeminiMessage(page, effectivePrompt);
const urls = await waitForGeminiImages(page, beforeUrls, timeout);
const link = await currentGeminiLink(page);
if (!urls.length) {
throw new EmptyResultError('gemini image', `No generated image was detected. Open ${link} and check whether Gemini produced one.`);
}
if (skipDownload) {
return [{ status: '🎨 generated', file: '📁 -', link: `🔗 ${link}` }];
}
const assets = await exportGeminiImages(page, urls);
if (!assets.length) {
throw new CommandExecutionError('Failed to export the generated Gemini image', `Open ${link} and verify the image is visible, then retry.`);
}
const stamp = Date.now();
const results = [];
for (let index = 0; index < assets.length; index += 1) {
const asset = assets[index];
const base64 = asset.dataUrl.replace(/^data:[^;]+;base64,/, '');
const suffix = assets.length > 1 ? `_${index + 1}` : '';
const filePath = path.join(outputDir, `gemini_${stamp}${suffix}${extFromMime(asset.mimeType)}`);
await saveBase64ToFile(base64, filePath);
results.push({ status: '✅ saved', file: `📁 ${displayPath(filePath)}`, link: `🔗 ${link}` });
}View on GitHub (pinned to 49907e53dc)
Solutions
- Open the link in the error message to see what Gemini actually replied; rephrase the prompt as an explicit image request (e.g. 'Generate an image of ...')
- Increase --timeout (e.g. 120) and retry, since rendering can be slow
- Remove or soften prompt content that may trigger safety filters
- Retry later if generation is throttled or Gemini is degraded
Example fix
// before opencli gemini image --prompt "tell me about cats" --timeout 20 // after opencli gemini image --prompt "Generate an image of a fluffy cat" --timeout 120
Defensive patterns
Strategy: retry
Validate before calling
// Ensure the prompt explicitly requests an image
if (!/\b(image|picture|drawing|illustration)\b/i.test(prompt)) {
prompt = `Generate an image of ${prompt}`;
} Type guard
function isNonEmptyString(v){ return typeof v === 'string' && v.trim().length > 0; } Try / catch
try {
return await run(['gemini','image','--prompt',prompt,'--timeout','120']);
} catch (e) {
if (String(e.message).includes('No generated image was detected')) {
// Inspect the link in the message, rephrase the prompt, retry once
return await run(['gemini','image','--prompt',`Generate an image of ${prompt}`,'--timeout','180']);
}
throw e;
} Prevention
- Phrase prompts as explicit image-generation requests
- Use a generous --timeout (>= 90s) for slow generation
- Open the returned conversation link to see Gemini's actual reply before rephrasing
- Avoid prompt content likely to trigger safety refusals
When it happens
Trigger: Gemini replied with text instead of an image (prompt asked for something it declined or interpreted as text); image took longer than --timeout to render; the response stream errored; safety filters blocked image generation for the prompt content.
Common situations: Prompt phrased as a question rather than an image request ('draw' missing); prompts triggering safety refusals; very slow generation exceeding the timeout on busy periods; account throttling on image generation quota.
Related errors
- chatgpt image
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- No finished image appeared before timeout. Re-run with a hig
- No Claude response appeared within ${timeoutSeconds}s. Re-ru
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bbac090948009a02.
Report an issue: GitHub.