jackwener/OpenCLI · error · ArgumentError
No model matched "${wantSet}". Available: ${opts.join(', ')}
Error message
No model matched "${wantSet}". Available: ${opts.join(', ')} What it means
When setting the Kimi model, after exact and substring matching against dropdown options, idx remains -1 if nothing matched; the command closes the menu and throws ArgumentError listing every available option. This guarantees the active model is never silently left unchanged.
Source
Thrown at clis/kimi/ui.js:266
.filter((t, i, arr) => arr.indexOf(t) === i)
.slice(0, 20);
})()`);
if (wantSet) {
const normalizeModel = (value) => String(value || '').toLowerCase().replace(/[^a-z0-9.\u4e00-\u9fa5]+/g, '');
const needle = normalizeModel(wantSet);
const exactIdx = opts.findIndex((t) => normalizeModel(t) === needle);
const partialMatches = exactIdx >= 0 ? [] : opts
.map((model, index) => ({ model, index }))
.filter((item) => normalizeModel(item.model).includes(needle));
if (exactIdx < 0 && partialMatches.length > 1) {
try { await page.evaluate(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));`); } catch {}
throw new ArgumentError('set', `Model "${wantSet}" is ambiguous: ${partialMatches.map(item => item.model).join(', ')}`);
}
const idx = exactIdx >= 0 ? exactIdx : partialMatches[0]?.index ?? -1;
if (idx < 0) {
try { await page.evaluate(`document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));`); } catch {}
throw new ArgumentError('set', `No model matched "${wantSet}". Available: ${opts.join(', ')}`);
}
const clickRes = await page.evaluate(`(() => {
${IS_VISIBLE_JS}
const popovers = Array.from(document.querySelectorAll('[class*="popover"i], [class*="dropdown"i], [role="menu"], [role="listbox"]')).filter(isVisible);
const pop = popovers[popovers.length - 1];
if (!pop) return { ok: false };
const items = Array.from(pop.querySelectorAll('div, li, button, [role="option"], [role="menuitem"]'))
.filter(isVisible)
.filter((el) => { const t = (el.innerText || '').trim(); return t && t.length < 80 && (/K\\d|Kimi|Pro\\b|Auto|思考/.test(t)); });
const target = items[${idx}];
if (!target) return { ok: false };
target.click();
return { ok: true, clicked: (target.innerText || '').trim() };
})()`);
if (!clickRes?.ok) throw new CommandExecutionError('Failed to click model option', '');
await page.wait(0.5);
const verified = await page.evaluate(`(() => {
${IS_VISIBLE_JS}View on GitHub (pinned to 49907e53dc)
Solutions
- Use one of the exact names printed in the error's Available: list.
- Run the model list command to enumerate current options and update scripts.
- Check your Kimi account/region exposes the requested model.
- Update the library if model names changed upstream.
Example fix
// before
await run('kimi', 'model', { set: 'Kimi K1.5' }); // no longer offered
// after
await run('kimi', 'model', { set: 'Kimi K2' }); // from Available list Defensive patterns
Strategy: validation
Validate before calling
const models = await run('kimi', 'model');
const ok = models.some(m => normalize(m.Model) === normalize(want));
if (!ok) throw new Error(`"${want}" not offered; use: ${models.map(m => m.Model).join(', ')}`); Try / catch
try {
await run('kimi', 'model', { set: want });
} catch (e) {
if (/No model matched/.test(e.message)) {
const available = e.message.match(/Available: (.*)$/)?.[1].split(', ') ?? [];
await run('kimi', 'model', { set: available[0] }); // safe fallback
} else throw e;
} Prevention
- Source model names dynamically from the list command, not hardcoded literals.
- Pin known-good model names in config with a startup validation check.
- Re-check names after Kimi version/deployment changes.
When it happens
Trigger: Calling the kimi model set command with a model name that neither exactly nor partially matches any option rendered in the dropdown, e.g. a discontinued or renamed model string.
Common situations: Hardcoded model name from an older Kimi version; typo ('Kimi K3'); region/account lacking certain models so they never appear as options.
Related errors
- must be a Kimi chat id or https://www.kimi.com/chat/<id> URL
- is required
- must be "like" or "dislike"
- must be "local" or "session"
- is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/384caa40e6e9f2be.
Report an issue: GitHub.