jackwener/OpenCLI · error · CommandExecutionError
Visible Midjourney control "${label}" was not found
Error message
Visible Midjourney control "${label}" was not found What it means
CommandExecutionError thrown when clickVisibleControl cannot find an enabled visible button matching the given label (matched by text or aria-label). The in-page lookup returns null when no match exists or the match is disabled.
Source
Thrown at clis/midjourney/utils.js:1240
return target;
}
export async function clickVisibleControl(page, label) {
const target = unwrapEvaluateResult(await page.evaluate((wanted) => {
const visible = (element) => {
const rect = element.getBoundingClientRect();
return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';
};
const button = [...document.querySelectorAll('button')].find((node) => visible(node) && (
node.textContent?.trim().replace(/\s+/g, ' ') === wanted
|| node.title === wanted
|| node.getAttribute('aria-label') === wanted
));
if (!button || button.disabled) return null;
const rect = button.getBoundingClientRect();
return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 };
}, label));
if (!target) throw new CommandExecutionError(`Visible Midjourney control "${label}" was not found`);
if (typeof page.nativeClick !== 'function') throw new CommandExecutionError('Browser Bridge native click support is required');
await page.nativeClick(target.x, target.y);
}
export async function clickComposerSubmit(page) {
const marked = unwrapEvaluateResult(await page.evaluate(() => {
document.querySelectorAll('[data-opencli-composer-submit]').forEach((node) => {
node.removeAttribute('data-opencli-composer-submit');
});
const visible = (element) => {
const rect = element.getBoundingClientRect();
return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';
};
const input = document.querySelector('#desktop_input_bar');
const row = input?.parentElement;
if (!input || !row) return false;
const textSubmit = [...row.querySelectorAll('button')]
.find((button) => visible(button) && button.textContent?.trim() === 'Submit');View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the exact visible label/aria-label in the UI and pass it verbatim.
- Open/expand the panel containing the control before clicking.
- Wait for the control to become enabled (job completion) and retry.
- List visible controls first (clickVisibleControl-style enumeration) to debug matching.
Example fix
// before await clickVisibleControl(page, 'U1'); // after await page.wait(1); // ensure grid rendered await clickVisibleControl(page, 'U1');
Defensive patterns
Strategy: validation
Validate before calling
const exists = await page.evaluate((label) =>
[...document.querySelectorAll('button,[role=button]')].some(b =>
!b.disabled && (b.textContent?.trim() === label || b.getAttribute('aria-label') === label)), label);
if (!exists) throw new Error(`Control "${label}" is not visible/enabled`); Try / catch
try {
await clickVisibleControl(page, label);
} catch (err) {
if (String(err.message).includes('was not found')) {
await page.wait(2);
await clickVisibleControl(page, label);
} else throw err;
} Prevention
- Pass labels verbatim from the UI
- Expand menus/panels so the control is rendered
- Wait for async content before clicking
- Retry once for late-rendered controls
When it happens
Trigger: clickVisibleControl(page, label) where no rendered button/element has exactly that text or aria-label, or the matching element is disabled.
Common situations: Typo or different casing in the label; control not currently rendered (collapsed menu, wrong tab); element is a div not matching the selector; button disabled because a job is running.
Related errors
- Could not locate Midjourney ${slotLabel} slot after upload
- Midjourney Creation Action unavailable: ${target?.reason ||
- SELECTOR
- Could not find Antigravity input box
- Could not find input box
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/86694b711e8b2faa.
Report an issue: GitHub.