jackwener/OpenCLI · error · CliError

SELECTOR

SELECTOR

Error message

Could not find element: TRAE SOLO model trigger (.core-model-select-trigger). Make sure a chat task is open (not the project-list view).

What it means

selectorError is thrown when the TRAE SOLO composer's model selector trigger element (.core-model-select-trigger) cannot be found on the page. readCurrentModel returned no value, meaning the DOM does not contain the trigger, which typically only renders inside an open chat/SOLO task view.

Source

Thrown at clis/trae-solo/model.js:32

    name: 'model',
    access: 'write',
    description: 'Read or switch the current AI model in TRAE SOLO. Without arguments, reports the current model. With <name> argument (substring, case-insensitive), switches to a matching model. Pass --list to enumerate available models.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'name', required: false, positional: true, help: 'Target model name (substring match, case-insensitive). Omit to read current.' },
        { name: 'list', type: 'boolean', default: false, help: 'List all available models (does not switch)' },
    ],
    columns: ['Status', 'Model'],
    func: async (page, kwargs) => {
        const name = String(kwargs.name || '').trim().toLowerCase();
        const listOnly = kwargs.list === true || kwargs.list === 'true';

        // Read current model from the composer trigger
        const current = await readCurrentModel(page);
        if (!current) {
            throw selectorError('TRAE SOLO model trigger (.core-model-select-trigger). Make sure a chat task is open (not the project-list view).');
        }

        // List or switch — both require opening the menu
        if (listOnly || name) {
            const namejson = JSON.stringify(name);

            // Stage 1 (eval): open the trigger + enumerate option labels.
            const stage1 = await page.evaluate(`(async () => {
        const wait = (ms) => new Promise((r) => setTimeout(r, ms));
        const trigger = document.querySelector('.core-model-select-trigger');
        if (!trigger) return { ok: false, reason: 'model trigger gone' };
        const r = trigger.getBoundingClientRect();
        const init = {
          bubbles: true, cancelable: true, button: 0, buttons: 1,
          clientX: Math.round(r.left + Math.min(r.width / 2, 20)),
          clientY: Math.round(r.top + Math.min(r.height / 2, 10)),
        };
        trigger.dispatchEvent(new PointerEvent('pointerdown', { ...init, pointerType: 'mouse' }));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open a SOLO chat task in TRAE so the composer (and its .core-model-select-trigger) is rendered, then retry
  2. Navigate the controlled page back to the chat/task view, not the project-list view
  3. Verify the page actually finished loading the composer before running the model command
  4. If the UI changed, update the .core-model-select-trigger selector in model.js to the new class name

Example fix

// before: running against project-list view
await opencli trae-solo model --list
// after: open a chat task first
await opencli trae-solo open --task '...' && opencli trae-solo model --list
Defensive patterns

Strategy: validation

Validate before calling

const ready = await page.$('.core-model-select-trigger');
if (!ready) throw new Error('Open a TRAE SOLO chat task before running the model command');

Type guard

function hasModelTrigger(page) { return page.$('.core-model-select-trigger').then(Boolean); }

Try / catch

try {
  await opencli trae-solo model --list;
} catch (e) {
  if (e.code === 'SELECTOR' && /core-model-select-trigger/.test(e.message)) {
    await openTraeChatTask(); // navigate to a chat task, then retry once
    await opencli trae-solo model --list;
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the model command (list or switch) via clis/trae-solo/model.js while the browser page is not showing a chat task — e.g. the project-list view is open, or no SOLO task session exists.

Common situations: User ran the model command before opening a chat task; the tab navigated back to the project list; the TRAE SOLO UI changed and the .core-model-select-trigger class no longer exists in that page version.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/7126a5ecbba9d630. Report an issue: GitHub.