{"record":{"id":"061f372295346331","repo":"jackwener/OpenCLI","slug":"knowledge-button-not-found","errorCode":null,"errorMessage":"Knowledge button not found","messagePattern":"Knowledge button not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/qoder/ui.js","lineNumber":149,"sourceCode":"        await page.wait(0.5);\n        return [{ Status: 'clicked' }];\n    },\n});\n\n// -------- knowledge --------\ncli({\n    site: 'qoder',\n    name: 'knowledge',\n    access: 'write',\n    description: 'Open the Knowledge view (Qoder\\'s personal/team knowledge base).',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],\n    func: async (page) => {\n        const res = await evaluateQoder(page, clickByTextScript(['Knowledge']));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Knowledge button not found', '');\n        return [{ Status: 'clicked' }];\n    },\n});\n\n// -------- marketplace --------\ncli({\n    site: 'qoder',\n    name: 'marketplace',\n    access: 'write',\n    description: 'Open the Qoder Marketplace.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],\n    func: async (page) => {\n        const res = await evaluateQoder(page, clickByTextScript(['Marketplace']));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Marketplace button not found', '');","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qoder/ui.js#L131-L167","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Add a wait/retry so the UI finishes rendering, then re-run the knowledge command.","Dismiss any modal dialogs (welcome screen, update prompt) that cover the top bar.","Check the current Qoder version; if the button label changed, update the clickByTextScript(['Knowledge']) pattern in clis/qoder/ui.js.","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."],"exampleFix":"// before: click immediately\nconst res = await evaluateQoder(page, clickByTextScript(['Knowledge']));\n// after: wait for UI, then retry once\nawait page.wait(2);\nlet res = await evaluateQoder(page, clickByTextScript(['Knowledge']));\nif (!res?.ok) { await page.wait(2); res = await evaluateQoder(page, clickByTextScript(['Knowledge'])); }","handlingStrategy":"retry","validationCode":"async function knowledgeButtonVisible(page) {\n  const probe = await page.evaluate(`(() => {\n    const els = Array.from(document.querySelectorAll('button, [role=\"button\"], a, [role=\"tab\"]'));\n    return els.some(b => (b.innerText||'').toLowerCase().includes('knowledge') && b.getBoundingClientRect().width > 0);\n  })()`);\n  return probe === true;\n}","typeGuard":"function isClickResult(res) {\n  return res !== null && typeof res === 'object' && typeof res.ok === 'boolean';\n}","tryCatchPattern":"try {\n  await cli.run(['qoder', 'knowledge']);\n} catch (e) {\n  if (String(e.message).includes('Knowledge button not found')) {\n    await page.wait(3);            // let UI finish rendering\n    await cli.run(['qoder', 'knowledge']); // retry once\n  } else throw e;\n}","preventionTips":["Always launch Qoder via the CDP-enabled launcher and wait a few seconds before UI commands","Dismiss welcome/update dialogs before running top-bar commands","Pin/verify the Qoder version; check labels after upgrades","Wrap UI commands in a small retry-with-delay helper"],"tags":["ui-automation","electron","cdp","selector-not-found"],"backgroundTag":"ui-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}