{"record":{"id":"f5ebc93687537d22","repo":"jackwener/OpenCLI","slug":"new-quest-button-not-found","errorCode":null,"errorMessage":"New Quest button not found","messagePattern":"New Quest button not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/qoder/quest.js","lineNumber":42,"sourceCode":"        if (Number(afterCount) > Number(beforeCount)) return afterCount;\n    }\n    return beforeCount;\n}\n\n// -------- new --------\ncli({\n    site: 'qoder',\n    name: 'new',\n    access: 'write',\n    description: 'Start a new Qoder Quest (conversation). Clicks the \"New Quest\" button in the sidebar (or its ⌘N variant).',\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(['New Quest']));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'New Quest button not found', '');\n        await page.wait(0.5);\n        return [{ Status: 'started' }];\n    },\n});\n\n// -------- send --------\ncli({\n    site: 'qoder',\n    name: 'send',\n    access: 'write',\n    description: 'Type text into the Qoder composer and click \"Send message\" (fire-and-forget).',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'text', positional: true, required: true, help: 'Text to send' },\n    ],\n    columns: ['Status', 'Length'],","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qoder/quest.js#L24-L60","documentation":"Thrown by the qoder new command when clickByTextScript fails to find or click the 'New Quest' button in the Qoder sidebar. The command starts a new Quest purely by UI automation; failure means the button is not present/clickable in the current DOM, and the thrown message falls back to this text when res?.reason is empty.","triggerScenarios":"Running `qoder new` when: the sidebar is collapsed (New Quest hides or becomes an icon-only ⌘N control); Qoder is on a screen without the sidebar (Settings, full-screen editor); the app updated and renamed the button (e.g. 'New Chat'); the webview is still loading; or evaluateQoder could not evaluate in the Qoder frame.","commonSituations":"Narrow windows collapsing the sidebar to icon mode where the text label no longer matches; localized builds with non-English labels; automation racing app startup before the sidebar mounts; stale page handles after the Qoder window was reopened.","solutions":["Expand/widen the Qoder sidebar so the labeled 'New Quest' button is visible, then rerun.","Add a startup wait/retry around the click script so it runs after the sidebar has mounted.","If Qoder renamed the control, inspect the sidebar DOM and add the new label (and localized variants) to the clickByTextScript candidate list.","As a fallback, send the ⌘N/Ctrl+N keyboard shortcut via page automation to trigger a new quest when the button is icon-only."],"exampleFix":"// before\nconst res = await evaluateQoder(page, clickByTextScript(['New Quest']));\n// after\nawait page.wait(1);\nlet res = await evaluateQoder(page, clickByTextScript(['New Quest', 'New Chat', '新建任务']));\nif (!res?.ok) res = await evaluateQoder(page, pressShortcutScript('Mod+N')); // icon-only sidebar fallback","handlingStrategy":"fallback","validationCode":"// Check the sidebar exposes a labeled New Quest control before invoking\nconst hasBtn = await page.evaluate(() =>\n  Array.from(document.querySelectorAll('button, [role=\"button\"]'))\n    .some(b => /new quest/i.test((b.innerText || '').trim()))\n);\nif (!hasBtn) console.warn('New Quest label not visible — sidebar may be collapsed; shortcut fallback will be needed');","typeGuard":"function hasClickResult(res) {\n  return typeof res === 'object' && res !== null && res.ok === true;\n}","tryCatchPattern":"try {\n  await runCli('qoder new');\n} catch (e) {\n  if (String(e.message).includes('New Quest button not found')) {\n    await runCli('qoder open-panel');           // expand collapsed sidebar\n    await runCli('qoder new');                  // retry\n  } else throw e;\n}","preventionTips":["Keep the Qoder sidebar expanded (icon-only mode hides the text label).","Wait ~1s after launching/focusing Qoder before clicking sidebar buttons.","Verify button labels after each Qoder app update.","Fall back to the ⌘N/Ctrl+N shortcut when the button is icon-only."],"tags":["ui-automation","dom-click","browser","qoder"],"backgroundTag":"ui-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}