jackwener/OpenCLI · error · CommandExecutionError

Midjourney image upload input did not become active

Error message

Midjourney image upload input did not become active

What it means

During image upload setup the automation marks a usable <input type="file" accept*="image"> element in the page with a data attribute. If the input cannot be marked even after clicking the 'Add Images' control and waiting 10 seconds for the selector, this CommandExecutionError is thrown because the upload cannot proceed without an active file input.

Source

Thrown at clis/midjourney/utils.js:951

  const markInput = async () => unwrapEvaluateResult(await page.evaluate(() => {
    document.querySelectorAll('[data-opencli-image-input]').forEach((node) => node.removeAttribute('data-opencli-image-input'));
    const inputs = [...document.querySelectorAll('input[type="file"][accept*="image"]')];
    const active = inputs.find((input) => {
      let root = input.parentElement;
      for (let depth = 0; depth < 8 && root; depth += 1, root = root.parentElement) {
        const rect = root.getBoundingClientRect();
        if (rect.width > 100 && rect.height > 40) return true;
      }
      return false;
    });
    if (!active) return false;
    active.setAttribute('data-opencli-image-input', '1');
    return true;
  }));
  if (!await markInput()) {
    await clickVisibleControl(page, 'Add Images');
    await page.wait({ selector: 'input[type="file"][accept*="image"]', timeout: 10 });
    if (!await markInput()) throw new CommandExecutionError('Midjourney image upload input did not become active');
  }
}

export async function clearImagePrompts(page) {
  await openImagePanel(page);
  const clearVisible = unwrapEvaluateResult(await page.evaluate(() => {
    const button = document.querySelector('button[title="Clear Image Prompts"]');
    if (!button) return false;
    const rect = button.getBoundingClientRect();
    return rect.width > 0 && rect.height > 0;
  }));
  if (clearVisible) await clickVisibleControl(page, 'Clear Image Prompts');
}

export async function closeImagePanel(page) {
  const visible = Boolean(unwrapEvaluateResult(await page.evaluate(() => {
    const isVisible = (node) => {
      const rect = node.getBoundingClientRect();

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Ensure the session is logged in and the image panel/page fully loads before the call
  2. Update the library/CLI to a version matching the current Midjourney UI
  3. Re-run with a fresh page/load; transient render failures can prevent the input from appearing
  4. Manually verify the web UI still has an 'Add Images' control with a file input

Example fix

// before
await uploadReferences(page, refs); // page still on login screen
// after
await page.goto('https://www.midjourney.com/imagine');
await page.wait({ selector: 'text=Create', timeout: 30 }); // ensure app is ready/logged in
await uploadReferences(page, refs);
Defensive patterns

Strategy: fallback

Validate before calling

await page.wait({ selector: 'input[type="file"][accept*="image"]', timeout: 10 }).catch(() => { throw new Error('Page not ready: no image file input present (logged in? UI updated?)'); });

Type guard

const hasFileInput = (page) => page.evaluate(() => !!document.querySelector('input[type="file"][accept*="image"]'));

Try / catch

try {
  await prepareImageUpload(page);
} catch (e) {
  if (String(e.message).includes('upload input did not become active')) {
    await page.reload();
    await prepareImageUpload(page); // one retry on a fresh page
  } else throw e;
}

Prevention

When it happens

Trigger: The Midjourney page layout changed so no matching file input exists, the 'Add Images' control is missing/renamed, the page failed to load or is stuck on login/consent screens, or the panel never opens.

Common situations: Midjourney deployed a UI redesign, a slow/unauthenticated session leaves the app in a state without the upload button, or headless browser blocked the file picker overlay.

Related errors


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