jackwener/OpenCLI · error · CommandExecutionError

New Quest button not found

Error message

New Quest button not found

What it means

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.

Source

Thrown at clis/qoder/quest.js:42

        if (Number(afterCount) > Number(beforeCount)) return afterCount;
    }
    return beforeCount;
}

// -------- new --------
cli({
    site: 'qoder',
    name: 'new',
    access: 'write',
    description: 'Start a new Qoder Quest (conversation). Clicks the "New Quest" button in the sidebar (or its ⌘N variant).',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = await evaluateQoder(page, clickByTextScript(['New Quest']));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'New Quest button not found', '');
        await page.wait(0.5);
        return [{ Status: 'started' }];
    },
});

// -------- send --------
cli({
    site: 'qoder',
    name: 'send',
    access: 'write',
    description: 'Type text into the Qoder composer and click "Send message" (fire-and-forget).',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'text', positional: true, required: true, help: 'Text to send' },
    ],
    columns: ['Status', 'Length'],

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Expand/widen the Qoder sidebar so the labeled 'New Quest' button is visible, then rerun.
  2. Add a startup wait/retry around the click script so it runs after the sidebar has mounted.
  3. If Qoder renamed the control, inspect the sidebar DOM and add the new label (and localized variants) to the clickByTextScript candidate list.
  4. As a fallback, send the ⌘N/Ctrl+N keyboard shortcut via page automation to trigger a new quest when the button is icon-only.

Example fix

// before
const res = await evaluateQoder(page, clickByTextScript(['New Quest']));
// after
await page.wait(1);
let res = await evaluateQoder(page, clickByTextScript(['New Quest', 'New Chat', '新建任务']));
if (!res?.ok) res = await evaluateQoder(page, pressShortcutScript('Mod+N')); // icon-only sidebar fallback
Defensive patterns

Strategy: fallback

Validate before calling

// Check the sidebar exposes a labeled New Quest control before invoking
const hasBtn = await page.evaluate(() =>
  Array.from(document.querySelectorAll('button, [role="button"]'))
    .some(b => /new quest/i.test((b.innerText || '').trim()))
);
if (!hasBtn) console.warn('New Quest label not visible — sidebar may be collapsed; shortcut fallback will be needed');

Type guard

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

Try / catch

try {
  await runCli('qoder new');
} catch (e) {
  if (String(e.message).includes('New Quest button not found')) {
    await runCli('qoder open-panel');           // expand collapsed sidebar
    await runCli('qoder new');                  // retry
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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