jackwener/OpenCLI · error · CommandExecutionError

Could not verify Midjourney ${anchorText}: expected ${target

Error message

Could not verify Midjourney ${anchorText}: expected ${targetText}, found ${selected || 'unknown'}

What it means

CommandExecutionError from selectSiteSetting's post-click verification. After clicking the chosen option the helper re-reads site settings and compares the reported value for the anchor (special-cased for 'Video Resolution' and 'Video Batch Size') with targetText; on mismatch it throws, reporting expected vs found ('unknown' when the field could not be read).

Source

Thrown at clis/midjourney/utils.js:1441

        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

  1. Increase the post-click wait before verification or retry the select once
  2. Ensure targetText formatting matches the read-back exactly (uppercase for Video Resolution, plain string like '2' for batch size)
  3. Confirm the click actually happened (bridge nativeClick working) and the option was enabled
  4. Update the CLI if Midjourney changed the setting value formatting

Example fix

// before
await selectSiteSetting(page, 'Video Resolution', ['SD', 'HD'], 'hd');
// after
await selectSiteSetting(page, 'Video Resolution', ['SD', 'HD'], 'HD'); // read-back is uppercased; target must be 'HD'
Defensive patterns

Strategy: validation

Validate before calling

// normalize target to the read-back format before calling
const target = anchor === 'Video Resolution' ? wanted.toUpperCase() : String(wanted);

Try / catch

try {
  await selectSiteSetting(page, 'Video Resolution', ['SD','HD'], 'HD');
} catch (e) {
  if (String(e.message).includes('Could not verify')) {
    await page.wait(1.5);
    await selectSiteSetting(page, 'Video Resolution', ['SD','HD'], 'HD');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling selectSiteSetting for 'Video Resolution' or 'Video Batch Size' when the click did not change the selection, the read-back normalizes differently (e.g. lowercase 'hd' vs target 'HD', string '2' vs 2), or the re-read returned null for the field.

Common situations: Click landed but UI reverted or needs another wait; mismatch between String(verified.videoBatchSize) formatting and targetText; panel re-rendered before verification; slow UI — 0.4s wait too short.

Related errors


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