{"record":{"id":"86a473d1fd4cd874","repo":"jackwener/OpenCLI","slug":"chatgpt-image","errorCode":null,"errorMessage":"chatgpt image","messagePattern":"chatgpt image","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/chatgpt/image.js","lineNumber":141,"sourceCode":"        }\n\n        // ChatGPT briefly navigates to /c/{id} after sending, then may\n        // redirect back to the home page. Poll until we capture the /c/ URL.\n        let convUrl = '';\n        for (let ci = 0; ci < 10; ci++) {\n            const url = await currentChatGPTLink(page);\n            if (url.includes('/c/')) { convUrl = url; break; }\n            await page.sleep(2);\n        }\n        if (!convUrl) {\n            convUrl = await currentChatGPTLink(page);\n        }\n\n        const urls = await waitForChatGPTImages(page, beforeUrls, timeout, convUrl);\n        const link = convUrl;\n\n        if (!urls.length) {\n            throw new EmptyResultError('chatgpt image', `No generated images were detected before timeout. Open ${link} and verify whether ChatGPT finished generating the image.`);\n        }\n\n        if (skipDownload) {\n            return [{ status: '🎨 generated', file: '📁 -', link: `🔗 ${link}` }];\n        }\n\n        // Export and save images\n        const assets = await getChatGPTImageAssets(page, urls);\n        if (!assets.length) {\n            throw new CommandExecutionError('Failed to export generated ChatGPT image assets', `Open ${link} and verify the generated images are visible, then retry.`);\n        }\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}` : '';","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/chatgpt/image.js#L123-L159","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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).","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."],"exampleFix":"// before\nopencli chatgpt image \"detailed cityscape\" --timeout 30\n// after\nopencli chatgpt image \"detailed cityscape\" --timeout 600","handlingStrategy":"fallback","validationCode":"// Budget enough time up front for slow generations\nconst timeout = process.env.CI ? 600 : 300;\nawait run('chatgpt image', prompt, '--timeout', String(timeout), '--sd');","typeGuard":"null","tryCatchPattern":"try {\n  const rows = await run('chatgpt image', prompt, '--timeout', '600');\n} catch (err) {\n  if (String(err.message).includes('chatgpt image')) {\n    // fallback: get the conversation link and let a human/next pass pick up the images\n    const link = err.message.match(/https:\\/\\/chatgpt\\.com\\/c\\/\\S+/)?.[0];\n    console.warn(`No images before timeout; check later: ${link}`);\n    return { pending: true, link };\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["chatgpt","timeout","image-generation","empty-result"],"backgroundTag":"empty-result-no-data","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}