jackwener/OpenCLI · error · TimeoutError

Midjourney Describe

Error message

Midjourney Describe

What it means

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'.

Source

Thrown at clis/midjourney/describe.js:125

              .map((node) => node.textContent?.trim().replace(/\s+/g, ' ') || '')
              .filter((text) => text.length >= 40 && /(?:^|\s)--ar\s+\d+(?:\.\d+)?:\d+(?:\.\d+)?(?:\s|$)/i.test(text));
            if (rows.length >= 4) {
              found.push(rows.slice(0, 4));
              break;
            }
          }
        }
        return found;
      });
      const baselineSignatures = new Set((baselineGroups || []).map((group) => JSON.stringify(group)));
      const newGroup = (groups || []).find((group) => !baselineSignatures.has(JSON.stringify(group)));
      if (newGroup) prompts = newGroup;
      else if (Array.isArray(groups) && groups.length > (baselineGroups?.length || 0)) prompts = groups[0];
      if (Array.isArray(prompts) && prompts.length === 4) break;
      await page.wait(1);
    }
    if (!Array.isArray(prompts) || prompts.length !== 4) {
      throw new TimeoutError('Midjourney Describe', timeout, 'Four visible prompt suggestions did not appear.');
    }
    return prompts.map((prompt, index) => ({
      rank: index + 1,
      prompt,
      source: displayPath(refs[0].value),
      created_at: startedAt,
    }));
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the command with a larger timeout value to allow Describe to finish
  2. Retry later or check Midjourney status, as slow generation under load commonly exceeds the deadline
  3. Verify the describe results render in the session; if the grouping DOM changed, update the group-detection logic in clis/midjourney/describe.js
  4. Accept fewer than 4 prompts if Midjourney legitimately returns fewer, by relaxing the prompts.length !== 4 requirement

Example fix

// before
if (!Array.isArray(prompts) || prompts.length !== 4) {
  throw new TimeoutError('Midjourney Describe', timeout, 'Four visible prompt suggestions did not appear.');
}
// after
if (!Array.isArray(prompts) || prompts.length === 0) {
  throw new TimeoutError('Midjourney Describe', timeout, 'No prompt suggestions appeared.');
}
Defensive patterns

Strategy: retry

Validate before calling

// Ensure the timeout is generous enough for slow Describe generation
const timeout = Number(process.env.MJ_DESCRIBE_TIMEOUT || 60);
if (timeout < 30) console.warn('Describe often needs >30s under load; consider raising the timeout.');

Type guard

function hasFourPrompts(value) {
  return Array.isArray(value) && value.length === 4 && value.every((p) => typeof p === 'string');
}

Try / catch

try {
  const prompts = await run('midjourney', 'describe', imagePath);
} catch (err) {
  if (err.name === 'TimeoutError' && err.message.includes('Midjourney Describe')) {
    // back off and retry once with a larger timeout
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/e518de6c8d273083. Report an issue: GitHub.