{"record":{"id":"e518de6c8d273083","repo":"jackwener/OpenCLI","slug":"midjourney-describe","errorCode":null,"errorMessage":"Midjourney Describe","messagePattern":"Midjourney Describe","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/describe.js","lineNumber":125,"sourceCode":"              .map((node) => node.textContent?.trim().replace(/\\s+/g, ' ') || '')\n              .filter((text) => text.length >= 40 && /(?:^|\\s)--ar\\s+\\d+(?:\\.\\d+)?:\\d+(?:\\.\\d+)?(?:\\s|$)/i.test(text));\n            if (rows.length >= 4) {\n              found.push(rows.slice(0, 4));\n              break;\n            }\n          }\n        }\n        return found;\n      });\n      const baselineSignatures = new Set((baselineGroups || []).map((group) => JSON.stringify(group)));\n      const newGroup = (groups || []).find((group) => !baselineSignatures.has(JSON.stringify(group)));\n      if (newGroup) prompts = newGroup;\n      else if (Array.isArray(groups) && groups.length > (baselineGroups?.length || 0)) prompts = groups[0];\n      if (Array.isArray(prompts) && prompts.length === 4) break;\n      await page.wait(1);\n    }\n    if (!Array.isArray(prompts) || prompts.length !== 4) {\n      throw new TimeoutError('Midjourney Describe', timeout, 'Four visible prompt suggestions did not appear.');\n    }\n    return prompts.map((prompt, index) => ({\n      rank: index + 1,\n      prompt,\n      source: displayPath(refs[0].value),\n      created_at: startedAt,\n    }));\n  },\n});\n","sourceCodeStart":107,"sourceCodeEnd":135,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/describe.js#L107-L135","documentation":"This TimeoutError is thrown when the Describe job produced results but the expected four prompt suggestions never became fully visible within the timeout window. The command polls the page for prompt groups until the deadline; it only succeeds when it collects an array of exactly 4 prompts, otherwise it raises this timeout naming 'Midjourney Describe'.","triggerScenarios":"The polling loop (while Date.now() < deadline) ended with prompts not being an array of exactly 4 items — e.g. Midjourney returned fewer than 4 suggestions, new describe-result groups never rendered, or generation was slow and exceeded the timeout.","commonSituations":"Midjourney server congestion making Describe slow; a UI change altering how describe results are grouped so the baseline-group comparison misses new results; an image that yields fewer than 4 suggestions; timeout set too low for slow accounts/queues.","solutions":["Re-run the command with a larger timeout value to allow Describe to finish","Retry later or check Midjourney status, as slow generation under load commonly exceeds the deadline","Verify the describe results render in the session; if the grouping DOM changed, update the group-detection logic in clis/midjourney/describe.js","Accept fewer than 4 prompts if Midjourney legitimately returns fewer, by relaxing the prompts.length !== 4 requirement"],"exampleFix":"// before\nif (!Array.isArray(prompts) || prompts.length !== 4) {\n  throw new TimeoutError('Midjourney Describe', timeout, 'Four visible prompt suggestions did not appear.');\n}\n// after\nif (!Array.isArray(prompts) || prompts.length === 0) {\n  throw new TimeoutError('Midjourney Describe', timeout, 'No prompt suggestions appeared.');\n}","handlingStrategy":"retry","validationCode":"// Ensure the timeout is generous enough for slow Describe generation\nconst timeout = Number(process.env.MJ_DESCRIBE_TIMEOUT || 60);\nif (timeout < 30) console.warn('Describe often needs >30s under load; consider raising the timeout.');","typeGuard":"function hasFourPrompts(value) {\n  return Array.isArray(value) && value.length === 4 && value.every((p) => typeof p === 'string');\n}","tryCatchPattern":"try {\n  const prompts = await run('midjourney', 'describe', imagePath);\n} catch (err) {\n  if (err.name === 'TimeoutError' && err.message.includes('Midjourney Describe')) {\n    // back off and retry once with a larger timeout\n  } else throw err;\n}","preventionTips":["Set a generous timeout for Describe, especially during peak Midjourney load","Retry once on timeout before surfacing the failure to users","Handle the case where Midjourney returns fewer than 4 suggestions gracefully","Check Midjourney status/queue health when timeouts recur"],"tags":["timeout","browser-automation","midjourney"],"backgroundTag":"operation-timed-out","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}