jackwener/OpenCLI · error · CommandExecutionError

Knowledge button not found

Error message

Knowledge button not found

What it means

The Qoder 'knowledge' UI command drives the Qoder IDE (Electron app) over CDP and clicks the first visible button/tab whose text contains 'Knowledge'. When evaluateQoder returns {ok:false} (clickByTextScript found no matching visible element) the command throws CommandExecutionError with the fallback message 'Knowledge button not found'. It is a UI-automation failure: the button was not present, visible, or text-matched at click time.

Source

Thrown at clis/qoder/ui.js:149

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

// -------- knowledge --------
cli({
    site: 'qoder',
    name: 'knowledge',
    access: 'write',
    description: 'Open the Knowledge view (Qoder\'s personal/team knowledge base).',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['Knowledge']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Knowledge button not found', '');
        return [{ Status: 'clicked' }];
    },
});

// -------- marketplace --------
cli({
    site: 'qoder',
    name: 'marketplace',
    access: 'write',
    description: 'Open the Qoder Marketplace.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['Marketplace']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Marketplace button not found', '');

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Ensure the Qoder IDE is running with CDP enabled (qoder-launch-with-cdp.sh, port 9237) and its window is visible before running the command.
  2. Add a wait/retry so the UI finishes rendering, then re-run the knowledge command.
  3. Dismiss any modal dialogs (welcome screen, update prompt) that cover the top bar.
  4. Check the current Qoder version; if the button label changed, update the clickByTextScript(['Knowledge']) pattern in clis/qoder/ui.js.
  5. Inspect the DOM manually (DevTools via CDP) to find the actual element and extend the selector list if it is not a button/a/tab.

Example fix

// before: click immediately
const res = await evaluateQoder(page, clickByTextScript(['Knowledge']));
// after: wait for UI, then retry once
await page.wait(2);
let res = await evaluateQoder(page, clickByTextScript(['Knowledge']));
if (!res?.ok) { await page.wait(2); res = await evaluateQoder(page, clickByTextScript(['Knowledge'])); }
Defensive patterns

Strategy: retry

Validate before calling

async function knowledgeButtonVisible(page) {
  const probe = await page.evaluate(`(() => {
    const els = Array.from(document.querySelectorAll('button, [role="button"], a, [role="tab"]'));
    return els.some(b => (b.innerText||'').toLowerCase().includes('knowledge') && b.getBoundingClientRect().width > 0);
  })()`);
  return probe === true;
}

Type guard

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

Try / catch

try {
  await cli.run(['qoder', 'knowledge']);
} catch (e) {
  if (String(e.message).includes('Knowledge button not found')) {
    await page.wait(3);            // let UI finish rendering
    await cli.run(['qoder', 'knowledge']); // retry once
  } else throw e;
}

Prevention

When it happens

Trigger: Running the 'knowledge' CLI command when the Qoder window is closed/minimized, the IDE UI has not finished rendering, the Knowledge button is behind a modal, the label changed in a Qoder update, or the element is not a button/[role=button]/a/[role=tab] as clickByTextScript requires.

Common situations: Launching the command before Qoder fully starts (CDP port 9237 open but UI still loading); Qoder version update renamed 'Knowledge'; the IDE is on a screen/state (welcome dialog, no window open) that hides the top-bar buttons; running headless without the Qoder GUI.

Related errors


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