{"record":{"id":"f418c8e2ac441848","repo":"jackwener/OpenCLI","slug":"midjourney-settings-panel-is-missing-required-fiel","errorCode":null,"errorMessage":"Midjourney settings panel is missing required field(s): ${missing.join(', ')}","messagePattern":"Midjourney settings panel is missing required field\\(s\\): (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/utils.js","lineNumber":1395,"sourceCode":"      }\n    }\n    const imageResolution = selectedNear('Version', ['Standard', 'HD']);\n    const personalization = selectedNear('Personalize', ['On', 'Off']);\n    const raw = selectedNear('Raw', ['Standard', 'Raw']);\n    return {\n      model: version ? `v${version}` : null,\n      imageResolution: imageResolution ? imageResolution.toLowerCase().replace('standard', 'sd') : null,\n      personalization: personalization ? personalization === 'On' : null,\n      raw: raw ? raw === 'Raw' : null,\n      speed: (selectedNear('Speed', ['Relax', 'Fast', 'Turbo']) || '').toLowerCase() || null,\n      videoResolution: (selectedNear('Video Resolution', ['SD', 'HD']) || '').toLowerCase() || null,\n      videoBatchSize: Number(selectedNear('Video Batch Size', ['1', '2', '4'])) || null,\n    };\n  }));\n  if (!result || typeof result !== 'object') throw new CommandExecutionError('Midjourney settings panel returned an unexpected shape');\n  const missing = ['model', 'imageResolution', 'speed'].filter((key) => result[key] == null);\n  if (missing.length) {\n    throw new CommandExecutionError(`Midjourney settings panel is missing required field(s): ${missing.join(', ')}`);\n  }\n  return result;\n}\n\nexport async function selectSiteSetting(page, anchorText, candidates, targetText) {\n  await readSiteSettings(page);\n  const target = unwrapEvaluateResult(await page.evaluate((anchorLabel, values, wanted) => {\n    const visible = (element) => {\n      const rect = element.getBoundingClientRect();\n      return rect.width > 0 && rect.height > 0 && getComputedStyle(element).display !== 'none';\n    };\n    document.querySelectorAll('[data-opencli-setting-target]').forEach((node) => node.removeAttribute('data-opencli-setting-target'));\n    const anchors = [...document.querySelectorAll('h2,a,div,span')]\n      .filter((node) => node.textContent?.trim() === anchorLabel && visible(node))\n      .sort((left, right) => left.children.length - right.children.length);\n    let root = anchors[0] || null;\n    for (let depth = 0; depth < 7 && root; depth += 1, root = root.parentElement) {\n      const buttons = [...root.querySelectorAll('button')].filter(visible);","sourceCodeStart":1377,"sourceCodeEnd":1413,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/utils.js#L1377-L1413","documentation":"CommandExecutionError from readSiteSettings. The settings object was read but one or more required keys — model, imageResolution, speed — are null, meaning those settings could not be located in the panel DOM. The message lists the missing fields.","triggerScenarios":"Calling readSiteSettings when the panel renders but labeled option groups ('Model', 'Image Resolution', 'Speed') are missing, collapsed, or renamed, so selectedNear() finds no selection and returns null for those keys.","commonSituations":"Midjourney changed setting labels or restructured the panel; fast/streak/relaxed variants hide some rows; panel only partially rendered when read; different account tier lacking some options.","solutions":["Wait longer after opening the panel so all setting groups render, then retry","Open the settings panel and visually confirm the missing group exists in current Midjourney UI","Update the CLI so its labels match the current settings DOM","Handle account variants where a setting legitimately has no selection"],"exampleFix":"// before\nconst s = await readSiteSettings(page);\n// after\nlet s;\ntry {\n  s = await readSiteSettings(page);\n} catch (e) {\n  if (String(e.message).includes('missing required field')) { await page.wait(1); s = await readSiteSettings(page); }\n  else throw e;\n}","handlingStrategy":"validation","validationCode":"const s = await readSiteSettings(page); // throws with missing-field list\n// pre-check keys yourself if reading raw:\nconst missing = ['model', 'imageResolution', 'speed'].filter((k) => s?.[k] == null);","typeGuard":"const hasRequiredSettings = (s) => ['model','imageResolution','speed'].every((k) => s?.[k] != null);","tryCatchPattern":"try {\n  return await readSiteSettings(page);\n} catch (e) {\n  const m = String(e.message).match(/missing required field\\(s\\): (.+)/);\n  if (m) { await page.wait(1.5); return readSiteSettings(page); }\n  throw e;\n}","preventionTips":["Wait for the whole panel to render, not just the toggle","Confirm your account tier exposes all required settings groups","Keep labels in the CLI matched to the live UI","Retry once on partial renders before surfacing the error"],"tags":["browser-automation","dom-selector","midjourney","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}