jackwener/OpenCLI · error · CliError
SELECTOR
SELECTOR
Error message
Could not find element: TRAE SOLO mode capsule (.index-module__capsule__ ...).
What it means
A SELECTOR CliError thrown by `trae-solo mode` (clis/trae-solo/mode.js:37) when the in-page evaluation cannot find the TRAE SOLO mode capsule element (matched via its .index-module__capsule__ class or the 'Switch to Code/Work mode' aria-label). Without the capsule, the CLI can neither read the current mode nor switch it, so it fails with 'Could not find element'.
Source
Thrown at clis/trae-solo/mode.js:37
],
columns: ['Status', 'Mode'],
func: async (page, kwargs) => {
const want = String(kwargs.target || '').trim().toLowerCase();
if (want && !['code', 'work'].includes(want)) {
throw new ArgumentError('target must be "code" or "work"');
}
const current = await page.evaluate(`(function() {
const cap = document.querySelector('[class*="capsule"]');
if (!cap) return '';
const aria = cap.getAttribute('aria-label') || '';
// aria says "Switch to <Other> mode" — current is the OTHER one.
const m = aria.match(/Switch to (Code|Work) mode/i);
if (m) return m[1].toLowerCase() === 'work' ? 'code' : 'work';
return '';
})()`);
if (!current) {
throw selectorError('TRAE SOLO mode capsule (.index-module__capsule__ ...).');
}
if (!want) {
return [{ Status: 'Active', Mode: current }];
}
if (current === want) {
return [{ Status: 'no-op (already in target mode)', Mode: current }];
}
await page.evaluate(`(async () => {
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const cap = document.querySelector('[class*="capsule"]');
if (!cap) return;
const r = cap.getBoundingClientRect();
const init = {
bubbles: true, cancelable: true, button: 0, buttons: 1,
clientX: Math.round(r.left + r.width / 2),
clientY: Math.round(r.top + r.height / 2),View on GitHub (pinned to 49907e53dc)
Solutions
- Update the capsule selector/aria regex in mode.js to match the current TRAE SOLO DOM (new hash and localized aria text)
- Make sure the IDE is in the main editor view where the mode capsule renders before running `trae-solo mode`
- Version-match: pin TRAE SOLO to a build whose capsule markup matches the selectors, or regenerate hash-based class names per build
- Report the mismatch upstream with the TRAE SOLO version and the capsule's current markup
Example fix
// before
const current = await page.evaluate(`...aria.match(/Switch to (Code|Work) mode/i)...`);
if (!current) throw selectorError('TRAE SOLO mode capsule (.index-module__capsule__ ...).');
// after
let current = await page.evaluate(capsuleScript());
if (!current) {
await page.wait(1); // allow IDE UI to finish mounting
current = await page.evaluate(capsuleScript());
}
if (!current) throw selectorError('TRAE SOLO mode capsule', 'Check .index-module__capsule__ hash and aria-label wording for your TRAE SOLO version'); Defensive patterns
Strategy: retry
Validate before calling
const capsule = await page.evaluate(() => {
const el = document.querySelector('[class*=capsule]') ||
[...document.querySelectorAll('[aria-label]')].find(n => /switch to (code|work) mode/i.test(n.getAttribute('aria-label')));
return !!el && el.getBoundingClientRect().width > 0;
});
if (!capsule) throw new Error('TRAE SOLO mode capsule not visible — check IDE view and version'); Type guard
function hasCapsuleResult(r) { return typeof r === 'string' && r.length > 0; } Try / catch
let current = await page.evaluate(capsuleProbeScript());
if (!hasCapsuleResult(current)) {
await page.wait(1.5); // let IDE UI mount
current = await page.evaluate(capsuleProbeScript());
}
if (!hasCapsuleResult(current)) throw selectorError('TRAE SOLO mode capsule'); Prevention
- Match selector/aria regexes to your TRAE SOLO version — hashed classes (.index-module__capsule__XX) change per build
- Include localized aria-label variants ('Switch to ... mode' in other languages) in the regex
- Maximize/normalize the IDE window so the capsule is rendered and visible
- Re-verify the capsule probe after every TRAE SOLO upgrade
When it happens
Trigger: `trae-solo mode` (with or without a target mode) runs the capsule-locating page.evaluate; the script returns an empty current value because the capsule element is absent — TRAE SOLO not in the expected view, hashed class names changed, or aria-label wording changed in a new version.
Common situations: TRAE SOLO version update changed the CSS-module hash (.index-module__capsule__XXXX) or the aria text 'Switch to <Mode> mode'; the IDE is not in the layout that renders the capsule; window too narrow so the capsule is hidden; English-only assumption broken by localized builds.
Related errors
- SELECTOR
- SELECTOR
- Could not find Antigravity input box
- Could not find input box
- Could not find antigravity.agentSidePanelInputBox
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/df1056359f5c89ba.
Report an issue: GitHub.