{"record":{"id":"bbac090948009a02","repo":"jackwener/OpenCLI","slug":"gemini-image-no-generated-image-was-detected-o","errorCode":null,"errorMessage":"'gemini image',`No generated image was detected. Open ${link} and check whether Gemini produced one.`","messagePattern":"'gemini image',`No generated image was detected\\. Open (.+?) and check whether Gemini produced one\\.`","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/gemini/image.js","lineNumber":100,"sourceCode":"        const timeout = kwargs.timeout;\n        if (!Number.isInteger(timeout) || timeout < 1) {\n            throw new ArgumentError('--timeout must be a positive integer (seconds)');\n        }\n        const startFresh = true;\n        const skipDownloadRaw = kwargs.sd;\n        const skipDownload = skipDownloadRaw === '' || skipDownloadRaw === true || normalizeBooleanFlag(skipDownloadRaw);\n        const effectivePrompt = buildImagePrompt(prompt, {\n            ratio,\n            style: style || undefined,\n        });\n        if (startFresh)\n            await startNewGeminiChat(page);\n        const beforeUrls = await getGeminiVisibleImageUrls(page);\n        await sendGeminiMessage(page, effectivePrompt);\n        const urls = await waitForGeminiImages(page, beforeUrls, timeout);\n        const link = await currentGeminiLink(page);\n        if (!urls.length) {\n            throw new EmptyResultError('gemini image', `No generated image was detected. Open ${link} and check whether Gemini produced one.`);\n        }\n        if (skipDownload) {\n            return [{ status: '🎨 generated', file: '📁 -', link: `🔗 ${link}` }];\n        }\n        const assets = await exportGeminiImages(page, urls);\n        if (!assets.length) {\n            throw new CommandExecutionError('Failed to export the generated Gemini image', `Open ${link} and verify the image is visible, then retry.`);\n        }\n        const stamp = Date.now();\n        const results = [];\n        for (let index = 0; index < assets.length; index += 1) {\n            const asset = assets[index];\n            const base64 = asset.dataUrl.replace(/^data:[^;]+;base64,/, '');\n            const suffix = assets.length > 1 ? `_${index + 1}` : '';\n            const filePath = path.join(outputDir, `gemini_${stamp}${suffix}${extFromMime(asset.mimeType)}`);\n            await saveBase64ToFile(base64, filePath);\n            results.push({ status: '✅ saved', file: `📁 ${displayPath(filePath)}`, link: `🔗 ${link}` });\n        }","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gemini/image.js#L82-L118","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nopencli gemini image --prompt \"tell me about cats\" --timeout 20\n// after\nopencli gemini image --prompt \"Generate an image of a fluffy cat\" --timeout 120","handlingStrategy":"retry","validationCode":"// Ensure the prompt explicitly requests an image\nif (!/\\b(image|picture|drawing|illustration)\\b/i.test(prompt)) {\n  prompt = `Generate an image of ${prompt}`;\n}","typeGuard":"function isNonEmptyString(v){ return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try {\n  return await run(['gemini','image','--prompt',prompt,'--timeout','120']);\n} catch (e) {\n  if (String(e.message).includes('No generated image was detected')) {\n    // Inspect the link in the message, rephrase the prompt, retry once\n    return await run(['gemini','image','--prompt',`Generate an image of ${prompt}`,'--timeout','180']);\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["empty-result","image-generation","timeout","cli"],"backgroundTag":"generation-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}