jackwener/OpenCLI · error · CommandExecutionError
Midjourney Imagine composer was not found.
Error message
Midjourney Imagine composer was not found.
What it means
The generate command drives the Midjourney web UI and must find the prompt composer input (COMPOSER_SELECTOR) before submitting a job. page.wait({ selector, timeout: 12 }) polls for up to 12 seconds; when the composer never appears, a CommandExecutionError is thrown telling the user to open the Imagine page in a signed-in Chrome. This is a UI-automation precondition failure, not an API failure.
Source
Thrown at clis/midjourney/generate.js:161
image: byKind(imageRefs, 'url'),
style: [...byKind(styleRefs, 'url'), ...byKind(styleRefs, 'styleCode')],
omni: byKind(omniRefs, 'url'),
};
const effectivePrompt = buildEffectivePrompt(prompt, plan, kwargs, remoteReferences);
if (normalizeBoolean(kwargs['dry-run'])) {
return [resultBase(plan, { status: 'planned' })];
}
const commandStartedAt = Date.now();
await recordQuotaSnapshot(account, 'generate-before');
const recent = await fetchHistory(page, account.user_id, 30);
const baselineIds = new Set(recent.map((job) => String(job.id || '').toLowerCase()).filter(Boolean));
for (const id of await getVisibleJobIds(page).catch(() => [])) baselineIds.add(id);
try {
await page.wait({ selector: COMPOSER_SELECTOR, timeout: 12 });
} catch {
throw new CommandExecutionError(
'Midjourney Imagine composer was not found.',
`Open ${MIDJOURNEY_IMAGINE_URL} in Chrome and confirm the signed-in composer is visible.`,
);
}
const localImageRefs = byKind(imageRefs, 'local');
const localStyleRefs = byKind(styleRefs, 'local');
const localOmniRefs = byKind(omniRefs, 'local');
// The persistent web composer may contain references staged manually or
// left by an interrupted command. Clear it for every paid submission so
// an argument-free generation cannot inherit hidden browser state.
await clearImagePrompts(page);
if (localImageRefs.length || localStyleRefs.length || localOmniRefs.length) {
await uploadReferencesToSlot(page, localImageRefs, 'image');
await uploadReferencesToSlot(page, localStyleRefs, 'style');
await uploadReferencesToSlot(page, localOmniRefs, 'omni');
}
await closeImagePanel(page);View on GitHub (pinned to 49907e53dc)
Solutions
- Open https://www.midjourney.com/imagine in the managed Chrome window and sign in so the composer is visible
- Re-run the command; transient slowness often resolves on retry
- Refresh the browser session/cookies for www.midjourney.com (re-authenticate)
- Update opencli — a Midjourney DOM change may require a patched COMPOSER_SELECTOR
Defensive patterns
Strategy: retry
Validate before calling
// Preconditions to check before running generate:
// 1. Session exists: navigate https://www.midjourney.com/imagine in the managed Chrome and confirm you are signed in (no login wall).
// 2. Composer visible (mirrors the internal check):
await page.wait({ selector: COMPOSER_SELECTOR, timeout: 12 }); Type guard
function composerFound(err) {
return err instanceof Error && /composer was not found/.test(err.message);
} Try / catch
try {
await generate(prompt, opts);
} catch (e) {
if (/composer was not found/.test(e.message)) {
await signInAndOpenImagine(); // re-establish session
await generate(prompt, opts); // retry once
} else throw e;
} Prevention
- Keep the persistent Chrome session signed in to midjourney.com; re-authenticate when cookies expire
- Run `opencli midjourney status` once first as a cheap session health check
- Avoid headless usage before completing an interactive login
- Keep opencli updated so COMPOSER_SELECTOR tracks Midjourney DOM changes
- Retry once on this error before escalating — page loads can be transiently slow
When it happens
Trigger: COMPOSER_SELECTOR does not match any visible element within 12 seconds after navigating to MIDJOURNEY_IMAGINE_URL — e.g. the user is not signed in, a cookie/login wall or Cloudflare interstitial is shown, the browser session was never established, or Midjourney redesigned the composer markup so the selector no longer matches.
Common situations: Expired Midjourney session cookies; running headless/background without ever having logged in interactively; Midjourney UI update changing the composer DOM; slow page load or rate-limit/captcha page replacing the app; running the tool before the persistent browser session exists.
Related errors
- Grok composer rejected the prompt: ${JSON.stringify(sendResu
- ${before.reason || `Failed to inspect ${name} state.`}${deta
- Midjourney did not expose a Describe action for the uploaded
- ChatGPT did not create a conversation URL after sending the
- Could not switch to ${wantModel} model
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/131051fce1c03dc5.
Report an issue: GitHub.