jackwener/OpenCLI · error · CommandExecutionError

Open Editor button not found

Error message

Open Editor button not found

What it means

Thrown by the qoder open-editor command when the DOM text-matching click script cannot find (or click) a button labeled 'Open Editor' in the Qoder UI. The command is a pure UI-automation wrapper: it evaluates clickByTextScript in the Qoder webview and surfaces res?.ok as a CommandExecutionError on failure. It means the expected editor-open control is absent from the current DOM.

Source

Thrown at clis/qoder/composer.js:42

        await page.wait(0.5);
        return [{ Status: 'enhanced (check composer)' }];
    },
});

// -------- open-editor --------
cli({
    site: 'qoder',
    name: 'open-editor',
    access: 'write',
    description: 'Click "Open Editor" — opens the current draft in a full editor pane.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['Open Editor']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Open Editor button not found', '');
        return [{ Status: 'clicked' }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Ensure a draft exists in the Qoder composer (Open Editor only appears with draft content), then rerun the command.
  2. Wait for UI readiness (page.wait) or retry the click a couple of times before declaring failure.
  3. Dump the button labels in the panel area and add the actual label as an additional candidate in clickByTextScript (including localized variants).
  4. Check res?.reason: if it indicates evaluation failure rather than button-not-found, fix the webview attach/evaluate path in evaluateQoder.

Example fix

// before
const res = await evaluateQoder(page, clickByTextScript(['Open Editor']));
// after
await page.wait(1);
const res = await evaluateQoder(page, clickByTextScript(['Open Editor', 'Open in Editor', '在编辑器中打开']));
Defensive patterns

Strategy: retry

Validate before calling

// Confirm an 'Open Editor' control exists before invoking the command
const hasBtn = await page.evaluate(() =>
  Array.from(document.querySelectorAll('button, [role="button"]'))
    .some(b => (b.innerText || '').trim() === 'Open Editor')
);
if (!hasBtn) throw new Error('Open Editor control not present — is there a draft in the composer?');

Type guard

function hasClickResult(res) {
  return typeof res === 'object' && res !== null && res.ok === true;
}

Try / catch

try {
  await runCli('qoder open-editor');
} catch (e) {
  if (String(e.message).includes('Open Editor button not found')) {
    await sleep(1500); // allow UI hydration, retry once
    return runCli('qoder open-editor');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `qoder open-editor` when: there is no active chat draft (Qoder hides the Open Editor affordance when the composer is empty); the Qoder app was updated and the label or DOM structure changed; the sidebar/panel containing the button is collapsed; or evaluateQoder failed to evaluate in the correct webview frame so the click never executed.

Common situations: Scripts that chain open-editor right after launching Qoder before the UI hydrates; users in localized Qoder builds where the button text differs; CI sessions where the Qoder window is backgrounded and the webview throttles rendering.

Related errors


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