jackwener/OpenCLI · error · CommandExecutionError
pickerResult?.reason || 'Failed to open model picker for mod
Error message
pickerResult?.reason || 'Failed to open model picker for model selection'
What it means
CommandExecutionError thrown when the in-page script that opens Gemini's model picker menu reports failure (or returns no result) after unwrapGeminiEvaluateResult. The library cannot proceed to select a thinking model unless the picker menu opens.
Source
Thrown at clis/gemini/utils.js:2727
* pattern with an explicit page.wait between them.
*/
export function selectGeminiModelScript(modelId) {
return selectModelInMenuScript(modelId);
}
/**
* Select a Gemini model by canonical id (e.g. "2.5-flash") in the
* web UI model picker. Opens the picker, waits for React, then clicks
* the matching entry. Throws CommandExecutionError on failure.
*/
export async function selectGeminiModel(page, modelId) {
await ensureGeminiPage(page);
// Open the picker menu.
const pickerRaw = await page.evaluate(openModelPickerForThinkingScript());
const pickerResult = unwrapGeminiEvaluateResult(pickerRaw, 'Gemini model picker');
if (!pickerResult || !pickerResult.ok) {
throw new CommandExecutionError(
pickerResult?.reason || 'Failed to open model picker for model selection'
);
}
// Wait for React to render the menu.
await page.wait(0.8);
// Find and click the matching menu item.
const raw = await page.evaluate(selectModelInMenuScript(modelId));
const result = unwrapGeminiEvaluateResult(raw, 'Gemini model selection');
if (!result || !result.ok) {
throw new CommandExecutionError(
result?.reason || 'Failed to select Gemini model "' + modelId + '"'
);
}
await page.wait(0.5);
const selectedModelId = await getCurrentGeminiModel(page);View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command (transient UI timing)
- Ensure the Gemini page is fully loaded and logged in before running
- Update the CLI to match the current Gemini DOM structure
Defensive patterns
Strategy: retry
Validate before calling
await page.wait(1.0); // let the app fully hydrate before model operations
const ready = await page.evaluate(() => !!document.body && document.body.innerText.length > 0);
if (!ready) throw new Error('Gemini page not ready for model picker interaction'); Try / catch
try {
await selectGeminiModel(page, modelId);
} catch (err) {
if (err.message.includes('model picker')) {
await page.reload();
await page.wait(2);
await selectGeminiModel(page, modelId); // one retry
} else throw err;
} Prevention
- Ensure you are logged in and past any consent/interstitial screens
- Reload the page and retry once before failing
- Keep the CLI version current with the Gemini UI
When it happens
Trigger: Calling the model-selection flow at clis/gemini/utils.js:2727 where openModelPickerForThinkingScript() returns ok:false or a reason, typically because the picker trigger button was not found or not clickable.
Common situations: Gemini UI update renaming/changing the picker button; page not logged in or showing an interstitial; slow React hydration; running while another menu is open.
Related errors
- result?.reason || 'Failed to select Gemini model "' + modelI
- Failed to extract Booking.com cards: ${err?.message || err}
- coupang add-to-cart evaluation failed: ${error?.message || e
- coupang search
- coupang search extraction failed: ${error?.message || error}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/25a0cd223e087c33.
Report an issue: GitHub.