{"record":{"id":"56e48604708ee79c","repo":"jackwener/OpenCLI","slug":"midjourney-image-upload-input-did-not-become-activ","errorCode":null,"errorMessage":"Midjourney image upload input did not become active","messagePattern":"Midjourney image upload input did not become active","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":951,"sourceCode":"  const markInput = async () => unwrapEvaluateResult(await page.evaluate(() => {\n    document.querySelectorAll('[data-opencli-image-input]').forEach((node) => node.removeAttribute('data-opencli-image-input'));\n    const inputs = [...document.querySelectorAll('input[type=\"file\"][accept*=\"image\"]')];\n    const active = inputs.find((input) => {\n      let root = input.parentElement;\n      for (let depth = 0; depth < 8 && root; depth += 1, root = root.parentElement) {\n        const rect = root.getBoundingClientRect();\n        if (rect.width > 100 && rect.height > 40) return true;\n      }\n      return false;\n    });\n    if (!active) return false;\n    active.setAttribute('data-opencli-image-input', '1');\n    return true;\n  }));\n  if (!await markInput()) {\n    await clickVisibleControl(page, 'Add Images');\n    await page.wait({ selector: 'input[type=\"file\"][accept*=\"image\"]', timeout: 10 });\n    if (!await markInput()) throw new CommandExecutionError('Midjourney image upload input did not become active');\n  }\n}\n\nexport async function clearImagePrompts(page) {\n  await openImagePanel(page);\n  const clearVisible = unwrapEvaluateResult(await page.evaluate(() => {\n    const button = document.querySelector('button[title=\"Clear Image Prompts\"]');\n    if (!button) return false;\n    const rect = button.getBoundingClientRect();\n    return rect.width > 0 && rect.height > 0;\n  }));\n  if (clearVisible) await clickVisibleControl(page, 'Clear Image Prompts');\n}\n\nexport async function closeImagePanel(page) {\n  const visible = Boolean(unwrapEvaluateResult(await page.evaluate(() => {\n    const isVisible = (node) => {\n      const rect = node.getBoundingClientRect();","sourceCodeStart":933,"sourceCodeEnd":969,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L933-L969","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the session is logged in and the image panel/page fully loads before the call","Update the library/CLI to a version matching the current Midjourney UI","Re-run with a fresh page/load; transient render failures can prevent the input from appearing","Manually verify the web UI still has an 'Add Images' control with a file input"],"exampleFix":"// before\nawait uploadReferences(page, refs); // page still on login screen\n// after\nawait page.goto('https://www.midjourney.com/imagine');\nawait page.wait({ selector: 'text=Create', timeout: 30 }); // ensure app is ready/logged in\nawait uploadReferences(page, refs);","handlingStrategy":"fallback","validationCode":"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?)'); });","typeGuard":"const hasFileInput = (page) => page.evaluate(() => !!document.querySelector('input[type=\"file\"][accept*=\"image\"]'));","tryCatchPattern":"try {\n  await prepareImageUpload(page);\n} catch (e) {\n  if (String(e.message).includes('upload input did not become active')) {\n    await page.reload();\n    await prepareImageUpload(page); // one retry on a fresh page\n  } else throw e;\n}","preventionTips":["Confirm the session is logged in and past consent screens before uploads","Wait for a page-ready signal (e.g. Create button) before upload steps","Keep the CLI updated against Midjourney UI changes","One reload+retry usually covers transient render failures"],"tags":["browser-automation","dom","timeout"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}