{"record":{"id":"c20f1633129fed12","repo":"jackwener/OpenCLI","slug":"could-not-select-thinking-level-thinkingvalue","errorCode":null,"errorMessage":"Could not select thinking level '${thinkingValue}' in the Gemini web UI","messagePattern":"Could not select thinking level '(.+?)' in the Gemini web UI","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/gemini/ask.js","lineNumber":253,"sourceCode":"                const availableList = [...allThinking].sort().join(', ');\n                throw new ArgumentError(\n                    `--thinking '${thinkingValue}' is not currently available`,\n                    `Available thinking values: ${availableList}. Run \\`opencli gemini models\\` for details.`,\n                );\n            }\n\n            // Select the requested thinking level before snapshot.\n            const selected = await selectGeminiThinking(page, thinkingValue);\n            if (!selected) {\n                // Build an informative hint from what we know.\n                const hintParts = [];\n                if (targetModelThinking && targetModelThinking.length > 0) {\n                    hintParts.push(`Model '${targetModelId}' supports: ${targetModelThinking.sort().join(', ')}.`);\n                } else if (allThinking.size > 0) {\n                    hintParts.push(`Available thinking values: ${[...allThinking].sort().join(', ')}.`);\n                }\n                hintParts.push('Run `opencli gemini models` for details.');\n                throw new ArgumentError(\n                    `Could not select thinking level '${thinkingValue}' in the Gemini web UI`,\n                    hintParts.join(' '),\n                );\n            }\n        }\n\n        const before = await readGeminiSnapshot(page);\n        await sendGeminiMessage(page, prompt);\n        const submissionStartedAt = Date.now();\n        const submitted = await waitForGeminiSubmission(page, before, timeout);\n        if (!submitted) {\n            return [{ response: `💬 ${NO_RESPONSE_PREFIX} No Gemini response within ${timeout}s.` }];\n        }\n        const remainingTimeoutSeconds = Math.max(0, timeout - Math.ceil((Date.now() - submissionStartedAt) / 1000));\n        const response = await waitForGeminiResponse(page, submitted, prompt, remainingTimeoutSeconds);\n        if (!response) {\n            return [{ response: `💬 ${NO_RESPONSE_PREFIX} No Gemini response within ${timeout}s.` }];\n        }","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gemini/ask.js#L235-L271","documentation":"An ArgumentError raised when clicking the requested thinking-level option in the Gemini web UI failed after validation passed. The message collects hint parts (per-model or union values plus the `opencli gemini models` pointer) to help the user pick a workable value.","triggerScenarios":"The UI interaction in the thinking-selection step after validation throws or returns failure, reaching the throw at clis/gemini/ask.js:253 (hintParts already built from targetModelThinking/allThinking).","commonSituations":"Gemini changed the thinking menu DOM so the option click misses; the option is present in discovery data but not rendered for the account/region; menu collapsed or re-rendered between open and click.","solutions":["Retry the command — a transient render race may have caused the click to miss","Verify the value via `opencli gemini models` and re-run with an exact listed value","Update the thinking-option selector in clis/gemini/ask.js if Gemini's UI changed","Increase wait time between opening the settings menu and clicking the option"],"exampleFix":"// before\nawait page.wait(0.5);\nawait clickThinkingOption(value);\n// after\nawait page.wait(2.0); // let the thinking menu render\nawait clickThinkingOption(value);","handlingStrategy":"retry","validationCode":"const models = await getGeminiModels();\nif (!models.some(m => (m.thinking || []).includes(thinkingValue))) {\n  throw new Error(`'${thinkingValue}' not offered — check opencli gemini models`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await askWithThinking(value);\n} catch (e) {\n  if (/Could not select thinking level/.test(e.message)) {\n    await page.reload(); await page.wait(3); // retry once\n  } else throw e;\n}","preventionTips":["Increase waits around settings-menu interactions","Keep thinking-option selectors current with Gemini DOM","Retry once on UI click failures before surfacing errors","Verify values against `opencli gemini models`"],"tags":["browser-automation","gemini","ui-selector"],"backgroundTag":"dom-selector-stale","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}