jackwener/OpenCLI · error · CommandExecutionError
Could not set Midjourney ${anchorText}: ${target?.reason ||
Error message
Could not set Midjourney ${anchorText}: ${target?.reason || targetText} What it means
CommandExecutionError from selectSiteSetting. The page-side evaluate that locates the anchor setting group and marks a matching candidate button returned { ok: false } (or nothing), so the setting could not be changed. The message includes the anchor (e.g. 'Model'), the desired target text, and the reason from the page script (e.g. 'X setting group not found').
Source
Thrown at clis/midjourney/utils.js:1430
for (let depth = 0; depth < 7 && root; depth += 1, root = root.parentElement) {
const buttons = [...root.querySelectorAll('button')].filter(visible);
const matching = buttons.filter((button) => values.includes(button.textContent?.trim()));
if (matching.length >= Math.min(2, values.length)) {
const button = matching.find((item) => item.textContent?.trim() === wanted);
if (!button) return { ok: false, reason: `${wanted} option not found` };
if (button.disabled) return { ok: false, reason: `${wanted} option is disabled` };
const selected = button.getAttribute('aria-pressed') === 'true'
|| button.getAttribute('aria-checked') === 'true'
|| ['active', 'checked', 'on'].includes(button.getAttribute('data-state'))
|| String(button.className).includes('text-splash');
if (selected) return { ok: true, changed: false };
button.setAttribute('data-opencli-setting-target', '1');
return { ok: true, changed: true };
}
}
return { ok: false, reason: `${anchorLabel} setting group not found` };
}, anchorText, candidates, targetText));
if (!target?.ok) throw new CommandExecutionError(`Could not set Midjourney ${anchorText}: ${target?.reason || targetText}`);
if (target.changed) {
await page.click('[data-opencli-setting-target="1"]');
await page.wait(0.4);
const verified = await readSiteSettings(page);
const selected = anchorText === 'Video Resolution'
? String(verified.videoResolution || '').toUpperCase()
: anchorText === 'Video Batch Size'
? String(verified.videoBatchSize || '')
: null;
if (selected !== targetText) {
throw new CommandExecutionError(
`Could not verify Midjourney ${anchorText}: expected ${targetText}, found ${selected || 'unknown'}`,
);
}
}
return target.changed;
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Confirm the settings panel is open and shows the anchor group; re-open via toggleSettingsPanel and retry
- Match targetText casing exactly to the candidate list (e.g. 'HD', 'Turbo', 'Raw')
- Update the CLI/candidate labels to the current Midjourney option names
- Read the target?.reason in the message to see whether the group or just the option was not found
Example fix
// before await selectSiteSetting(page, 'Speed', ['Relax', 'Fast', 'Turbo'], 'turbo'); // after await selectSiteSetting(page, 'Speed', ['Relax', 'Fast', 'Turbo'], 'Turbo'); // casing must match an enabled candidate
Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED = { Speed: ['Relax','Fast','Turbo'], 'Video Resolution': ['SD','HD'], 'Video Batch Size': ['1','2','4'] };
if (!ALLOWED[anchorText]?.includes(targetText)) throw new Error(`Unsupported ${anchorText} target: ${targetText}`); Try / catch
try {
await selectSiteSetting(page, anchor, candidates, target);
} catch (e) {
if (String(e.message).includes('Could not set Midjourney')) {
console.error('Check panel is open and target casing matches candidates:', e.message);
}
throw e;
} Prevention
- Pass targetText with exact candidate casing (e.g. 'Turbo', 'HD')
- Ensure the settings panel is open and the anchor group visible
- Check the reason embedded in the message (group vs option not found)
- Update candidate lists when Midjourney renames options
When it happens
Trigger: Calling selectSiteSetting(page, anchorText, candidates, targetText) when the anchor group (e.g. Model / Speed / Video Resolution / Video Batch Size) is absent from the settings panel, or none of the candidate labels matches a selectable option, or the target option is disabled.
Common situations: Setting label changed in Midjourney UI (candidates list out of date); settings panel not open — selectSiteSetting calls readSiteSettings first, which should throw earlier if the panel is broken; option exists but is disabled for the account tier; typo in targetText casing.
Related errors
- Midjourney composer submit control was not found
- Visible Midjourney Settings control was not found
- Midjourney settings panel returned an unexpected shape
- Midjourney settings panel is missing required field(s): ${mi
- Could not verify Midjourney ${anchorText}: expected ${target
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7acff4e34cc59606.
Report an issue: GitHub.