{"record":{"id":"8a0e86b55f43e773","repo":"jackwener/OpenCLI","slug":"grok-image-generation","errorCode":null,"errorMessage":"grok image generation","messagePattern":"grok image generation","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/grok/image.js","lineNumber":312,"sourceCode":"          }\n        } else {\n          stableCount = 0;\n          lastSignature = signature;\n          lastImages = images;\n        }\n      }\n    }\n\n    // Timeout — keep best-effort partial results if any image bubble showed\n    // up, otherwise surface the timeout instead of a sentinel row.\n    if (lastImages.length) {\n      if (outDir) {\n        const saved = await saveImages(page, lastImages, outDir);\n        return saved.map(s => toRow(s, s.path));\n      }\n      return lastImages.map(i => toRow(i));\n    }\n    throw new TimeoutError('grok image generation', Math.round(timeoutMs / 1000));\n  },\n});\n\nexport const __test__ = {\n  normalizePositiveInteger,\n  dedupeBySrc,\n  imagesSignature,\n  extFromContentType,\n  buildFilename,\n  pickLatestImageCandidate,\n};\n","sourceCodeStart":294,"sourceCodeEnd":324,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/grok/image.js#L294-L324","documentation":"The image command polls the conversation for generated images and, if none appear before timeoutMs elapses, throws TimeoutError naming 'grok image generation' with the elapsed seconds. Generation simply took longer than the configured budget or never produced images.","triggerScenarios":"Waiting for image bubbles after a successful prompt submission; getBubbleImageSets never yields a new image set within timeoutMs (timeoutMs / 1000 seconds reported).","commonSituations":"Very slow Grok image generation under load, --timeout set too low for complex prompts, generation silently failed server-side, or the tab was throttled/backgrounded so polling stalled.","solutions":["Increase the timeout option (e.g. --timeout 300) and re-run.","Keep the automated tab foregrounded/active so timers and network run normally.","Retry — Grok image generation can occasionally stall server-side.","Simplify the prompt if generation repeatedly times out."],"exampleFix":"// before\ncli image --prompt 'a castle' --timeout 60\n// after\ncli image --prompt 'a castle' --timeout 300","handlingStrategy":"fallback","validationCode":"// Choose a timeout proportional to prompt complexity:\nconst timeoutMs = Math.max(120_000, estimatedComplexity * 30_000);\nif (timeoutMs < 120_000) throw new Error('timeout too low for image generation');","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await cli.image({ prompt, timeout: 300 });\n} catch (e) {\n  if (e instanceof TimeoutError && e.message === 'grok image generation') {\n    console.warn('Generation exceeded the timeout; retrying with a larger budget...');\n    return cli.image({ prompt, timeout: 600 });\n  }\n  throw e;\n}","preventionTips":["Set generous timeouts (2-5 minutes) for image generation.","Keep the automated tab foregrounded so timers and network run.","Retry once on timeout before treating the job as failed.","Avoid overly complex prompts when generation stalls repeatedly."],"tags":["timeout","browser-automation","polling"],"backgroundTag":"operation-timed-out","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}