jackwener/OpenCLI · error · EmptyResultError
chatgpt image
Error message
chatgpt image
What it means
After sending the prompt, the command polls waitForChatGPTImages until new image URLs appear (bounded by --timeout). If the resulting URL list is empty, it throws EmptyResultError('chatgpt image') telling you no generated images were detected before the timeout and to check the conversation link manually. Generation may still be in progress or may have failed server-side.
Source
Thrown at clis/chatgpt/image.js:141
}
// ChatGPT briefly navigates to /c/{id} after sending, then may
// redirect back to the home page. Poll until we capture the /c/ URL.
let convUrl = '';
for (let ci = 0; ci < 10; ci++) {
const url = await currentChatGPTLink(page);
if (url.includes('/c/')) { convUrl = url; break; }
await page.sleep(2);
}
if (!convUrl) {
convUrl = await currentChatGPTLink(page);
}
const urls = await waitForChatGPTImages(page, beforeUrls, timeout, convUrl);
const link = convUrl;
if (!urls.length) {
throw new EmptyResultError('chatgpt image', `No generated images were detected before timeout. Open ${link} and verify whether ChatGPT finished generating the image.`);
}
if (skipDownload) {
return [{ status: '🎨 generated', file: '📁 -', link: `🔗 ${link}` }];
}
// Export and save images
const assets = await getChatGPTImageAssets(page, urls);
if (!assets.length) {
throw new CommandExecutionError('Failed to export generated ChatGPT image assets', `Open ${link} and verify the generated images are 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}` : '';View on GitHub (pinned to 49907e53dc)
Solutions
- Open the conversation link from the error and check whether images eventually appeared; if yes, just increase --timeout and retry.
- Raise --timeout (e.g. --timeout 600) for slow generations.
- Rephrase the prompt if ChatGPT refused to generate (policy refusals produce no images).
- Use --sd to skip download and just get the link while debugging.
- If images are visible in the browser but never detected, update the library's image-URL extraction.
Example fix
// before opencli chatgpt image "detailed cityscape" --timeout 30 // after opencli chatgpt image "detailed cityscape" --timeout 600
Defensive patterns
Strategy: fallback
Validate before calling
// Budget enough time up front for slow generations
const timeout = process.env.CI ? 600 : 300;
await run('chatgpt image', prompt, '--timeout', String(timeout), '--sd'); Type guard
null
Try / catch
try {
const rows = await run('chatgpt image', prompt, '--timeout', '600');
} catch (err) {
if (String(err.message).includes('chatgpt image')) {
// fallback: get the conversation link and let a human/next pass pick up the images
const link = err.message.match(/https:\/\/chatgpt\.com\/c\/\S+/)?.[0];
console.warn(`No images before timeout; check later: ${link}`);
return { pending: true, link };
}
throw err;
} Prevention
- Use a generous --timeout (>= 300s) for complex prompts
- Run once with --sd to confirm generation works before full runs
- Avoid prompts likely to trigger content-policy refusals (those yield no images)
- Check the conversation link from the error before concluding generation failed
- Keep the library updated so image-URL detection tracks ChatGPT UI changes
When it happens
Trigger: `opencli chatgpt image "prompt"` where waitForChatGPTImages returns [] within --timeout seconds — generation takes longer than the timeout, ChatGPT refuses/errors on the prompt, images render via a mechanism the extractor misses, or the /c/ URL capture failed so polling watched the wrong page.
Common situations: Complex prompts taking longer than the default 240s; content-policy refusals returning text instead of an image; heavy load slowing generation; ChatGPT UI changes to the image carousel breaking detection; timeout set too low (e.g. --timeout 30).
Related errors
- No finished image appeared before timeout. Re-run with a hig
- 'gemini image',`No generated image was detected. Open ${link
- chatgpt deep-research-result
- chatgpt detail
- chatgpt history
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/86a473d1fd4cd874.
Report an issue: GitHub.