jackwener/OpenCLI · error · CommandExecutionError
Midjourney settings panel returned an unexpected shape
Error message
Midjourney settings panel returned an unexpected shape
What it means
CommandExecutionError from readSiteSettings. After opening the settings panel it evaluates the DOM to build a settings object (model, imageResolution, speed, raw, speed, videoResolution, videoBatchSize); if the evaluation returns null or a non-object the shape is unexpected and it throws before the required-field check.
Source
Thrown at clis/midjourney/utils.js:1392
if (menu && /^\d+(?:\.\d+)?$/.test(menu.textContent?.trim() || '')) {
version = menu.textContent.trim();
break;
}
}
const imageResolution = selectedNear('Version', ['Standard', 'HD']);
const personalization = selectedNear('Personalize', ['On', 'Off']);
const raw = selectedNear('Raw', ['Standard', 'Raw']);
return {
model: version ? `v${version}` : null,
imageResolution: imageResolution ? imageResolution.toLowerCase().replace('standard', 'sd') : null,
personalization: personalization ? personalization === 'On' : null,
raw: raw ? raw === 'Raw' : null,
speed: (selectedNear('Speed', ['Relax', 'Fast', 'Turbo']) || '').toLowerCase() || null,
videoResolution: (selectedNear('Video Resolution', ['SD', 'HD']) || '').toLowerCase() || null,
videoBatchSize: Number(selectedNear('Video Batch Size', ['1', '2', '4'])) || null,
};
}));
if (!result || typeof result !== 'object') throw new CommandExecutionError('Midjourney settings panel returned an unexpected shape');
const missing = ['model', 'imageResolution', 'speed'].filter((key) => result[key] == null);
if (missing.length) {
throw new CommandExecutionError(`Midjourney settings panel is missing required field(s): ${missing.join(', ')}`);
}
return result;
}
export async function selectSiteSetting(page, anchorText, candidates, targetText) {
await readSiteSettings(page);
const target = unwrapEvaluateResult(await page.evaluate((anchorLabel, values, wanted) => {
const visible = (element) => {
const rect = element.getBoundingClientRect();
return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';
};
document.querySelectorAll('[data-opencli-setting-target]').forEach((node) => node.removeAttribute('data-opencli-setting-target'));
const anchors = [...document.querySelectorAll('h2,a,div,span')]
.filter((node) => node.textContent?.trim() === anchorLabel && visible(node))
.sort((left, right) => left.children.length - right.children.length);View on GitHub (pinned to 49907e53dc)
Solutions
- Call isSettingsPanelVisible first and open the panel via toggleSettingsPanel before reading
- Increase the wait after opening the panel so settings render
- Update the CLI to match current settings panel DOM
- Log the raw evaluate result to diagnose the shape mismatch
Example fix
// before
const settings = await readSiteSettings(page);
// after
if (!(await isSettingsPanelVisible(page))) {
await toggleSettingsPanel(page);
await page.wait(0.5);
}
const settings = await readSiteSettings(page); Defensive patterns
Strategy: validation
Validate before calling
if (!(await isSettingsPanelVisible(page))) {
await toggleSettingsPanel(page);
await page.wait(0.5);
} Type guard
const isSettingsShape = (r) => r != null && typeof r === 'object';
Try / catch
try {
const settings = await readSiteSettings(page);
} catch (e) {
if (String(e.message).includes('unexpected shape')) {
await toggleSettingsPanel(page); await page.wait(1);
return readSiteSettings(page);
}
throw e;
} Prevention
- Always open/verify the settings panel before reading
- Wait after opening so the panel fully renders
- Re-read after any navigation or re-render
- Update CLI when settings DOM changes
When it happens
Trigger: Calling readSiteSettings (directly or via selectSiteSetting) when the settings panel is not visible or its DOM did not yield the expected structure, so the evaluate callback returns null/undefined.
Common situations: Settings panel failed to open (toggle silently failed); Midjourney settings markup changed; page.evaluate wrapper returning an unwrapped null; navigation/rerender mid-read.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Midjourney settings panel is missing required field(s): ${mi
- Midjourney composer submit control was not found
- Visible Midjourney Settings control was not found
- Could not set Midjourney ${anchorText}: ${target?.reason ||
- Waiting for 12306 tk auth cookie
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c561a9f474d7df3a.
Report an issue: GitHub.