{"record":{"id":"8929639adbd499bc","repo":"jackwener/OpenCLI","slug":"could-not-verify-midjourney-anchortext-expecte","errorCode":null,"errorMessage":"Could not verify Midjourney ${anchorText}: expected ${targetText}, found ${selected || 'unknown'}","messagePattern":"Could not verify Midjourney (.+?): expected (.+?), found (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":1441,"sourceCode":"        if (selected) return { ok: true, changed: false };\n        button.setAttribute('data-opencli-setting-target', '1');\n        return { ok: true, changed: true };\n      }\n    }\n    return { ok: false, reason: `${anchorLabel} setting group not found` };\n  }, anchorText, candidates, targetText));\n  if (!target?.ok) throw new CommandExecutionError(`Could not set Midjourney ${anchorText}: ${target?.reason || targetText}`);\n  if (target.changed) {\n    await page.click('[data-opencli-setting-target=\"1\"]');\n    await page.wait(0.4);\n    const verified = await readSiteSettings(page);\n    const selected = anchorText === 'Video Resolution'\n      ? String(verified.videoResolution || '').toUpperCase()\n      : anchorText === 'Video Batch Size'\n        ? String(verified.videoBatchSize || '')\n        : null;\n    if (selected !== targetText) {\n      throw new CommandExecutionError(\n        `Could not verify Midjourney ${anchorText}: expected ${targetText}, found ${selected || 'unknown'}`,\n      );\n    }\n  }\n  return target.changed;\n}\n","sourceCodeStart":1423,"sourceCodeEnd":1448,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L1423-L1448","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase the post-click wait before verification or retry the select once","Ensure targetText formatting matches the read-back exactly (uppercase for Video Resolution, plain string like '2' for batch size)","Confirm the click actually happened (bridge nativeClick working) and the option was enabled","Update the CLI if Midjourney changed the setting value formatting"],"exampleFix":"// before\nawait selectSiteSetting(page, 'Video Resolution', ['SD', 'HD'], 'hd');\n// after\nawait selectSiteSetting(page, 'Video Resolution', ['SD', 'HD'], 'HD'); // read-back is uppercased; target must be 'HD'","handlingStrategy":"validation","validationCode":"// normalize target to the read-back format before calling\nconst target = anchor === 'Video Resolution' ? wanted.toUpperCase() : String(wanted);","typeGuard":null,"tryCatchPattern":"try {\n  await selectSiteSetting(page, 'Video Resolution', ['SD','HD'], 'HD');\n} catch (e) {\n  if (String(e.message).includes('Could not verify')) {\n    await page.wait(1.5);\n    await selectSiteSetting(page, 'Video Resolution', ['SD','HD'], 'HD');\n  } else throw e;\n}","preventionTips":["Match targetText to the read-back format (uppercase resolution, string batch size)","Allow a longer settle wait between click and verification","Confirm the click registered (working nativeClick) and option was enabled","Retry the select once before failing"],"tags":["browser-automation","verification","midjourney","settings"],"backgroundTag":"ui-state-verification-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}