{"record":{"id":"23290274fdc0e784","repo":"jackwener/OpenCLI","slug":"kimi-model-switch-did-not-verify-the-requested-mod","errorCode":null,"errorMessage":"Kimi model switch did not verify the requested model: requested \"${wantSet}\", current \"${verified || 'not visible'}\"","messagePattern":"Kimi model switch did not verify the requested model: requested \"(.+?)\", current \"(.+?)\"","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/kimi/ui.js","lineNumber":300,"sourceCode":"            await page.wait(0.5);\n            const verified = await page.evaluate(`(() => {\n      ${IS_VISIBLE_JS}\n      const svgs = Array.from(document.querySelectorAll('svg[name=\"Down_b\"]')).filter(isVisible);\n      for (const svg of svgs) {\n        let p = svg.parentElement;\n        for (let i = 0; i < 4 && p; i++) {\n          const spans = p.querySelectorAll('span');\n          for (const s of spans) {\n            const t = (s.textContent || '').trim();\n            if (/^K\\\\d|^Kimi |^Pro\\\\b|^Auto/.test(t)) return t;\n          }\n          p = p.parentElement;\n        }\n      }\n      return '';\n    })()`);\n            if (normalizeModel(verified) !== normalizeModel(clickRes.clicked)) {\n                throw new CommandExecutionError(\n                    `Kimi model switch did not verify the requested model: requested \"${wantSet}\", current \"${verified || 'not visible'}\"`,\n                    'Open the Kimi model menu and verify the requested model is selectable, then retry.',\n                );\n            }\n            return [{ Index: 1, Model: clickRes.clicked, Active: 'switched' }];\n        }\n\n        try { await page.evaluate(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));`); } catch {}\n        if (!opts.length) {\n            throw new EmptyResultError('kimi model', 'Model dropdown opened but no options detected.');\n        }\n        return opts.map((m, i) => ({ Index: i + 1, Model: m, Active: m === cur ? 'yes' : '' }));\n    },\n});\n","sourceCodeStart":282,"sourceCodeEnd":315,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/kimi/ui.js#L282-L315","documentation":"After clicking a model option, the command re-reads the visible model indicator (svg 'Down_b' neighbor text) and compares it (normalized) to the clicked label. If they differ — including when the indicator is not visible — it throws CommandExecutionError stating requested vs current model, with remediation guidance. This prevents reporting success when the switch silently didn't take effect.","triggerScenarios":"normalizeModel(verified) !== normalizeModel(clickRes.clicked): the click didn't register, the menu reverted, the page shows the previous model, or the verified text is empty/not visible.","commonSituations":"Kimi rejected the selection (network hiccup); indicator re-rendered with a different label than the option text; the clicked option was a sub-menu header rather than a selectable model; UI update changed the Down_b icon structure.","solutions":["Retry the model set command and then verify via the model get/list command.","Manually open the Kimi model menu and confirm the requested model is selectable, then retry (per the error hint).","Re-login or reload the page if the UI is in a stale state.","Update the library if the model-indicator markup changed."],"exampleFix":"// before\nawait run('kimi', 'model', { set: 'Kimi K2' }); // may throw unverified\n// after\ntry {\n  await run('kimi', 'model', { set: 'Kimi K2' });\n} catch (e) {\n  await page.reload();\n  await run('kimi', 'model', { set: 'Kimi K2' });\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"const verified = (cur, clicked) => normalizeModel(cur) === normalizeModel(clicked);","tryCatchPattern":"try {\n  await run('kimi', 'model', { set: want });\n} catch (e) {\n  if (/did not verify the requested model/.test(e.message)) {\n    await page.reload();\n    const cur = await run('kimi', 'model');\n    if (!cur.some(m => m.Active === 'yes' && normalize(m.Model) === normalize(want))) {\n      await run('kimi', 'model', { set: want });\n    }\n  } else throw e;\n}","preventionTips":["After any model switch, re-read the active model and assert it matches.","Treat silent switches as failures — rely on the library's verification instead of skipping it.","Reload the page when the UI indicator looks stale."],"tags":["verification","ui-automation","kimi"],"backgroundTag":"model-switch-not-verified","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}