jackwener/OpenCLI · warning · EmptyResultError

qoder history

Error message

qoder history

What it means

An EmptyResultError raised by the qoder history command when its sidebar-scraping heuristic finds zero Quest rows. The script collects visible clickable rows under sidebar/quest-list containers, filters out known menu items (New Quest, Search, Settings, etc.), and if nothing survives, the command throws EmptyResultError('qoder history', ...). It signals 'query executed fine but returned no rows', not a crash.

Source

Thrown at clis/qoder/history.js:45

      const seen = new Set();
      const out = [];
      sidebars.forEach((sb) => {
        const rows = Array.from(sb.querySelectorAll('[role="button"], button, [class*="item"i]')).filter(isVisible);
        rows.forEach((r) => {
          const txt = (r.innerText || r.textContent || '').trim().replace(/\\s+/g, ' ');
          if (!txt || txt.length < 2 || txt.length > 200) return;
          // Skip menu items, headers, action buttons.
          if (/^(New Quest|Search|Settings|View all|Knowledge|Marketplace|Credits Usage|Pin|Add Workspace|Open Editor|More Actions|Open Panel|Collapse|leo|button)$/i.test(txt.trim())) return;
          if (txt.includes('⌘')) return;
          if (seen.has(txt)) return;
          seen.add(txt);
          out.push(txt);
        });
      });
      return out;
    })()`), 'qoder history');
        if (!items.length) {
            throw new EmptyResultError('qoder history', 'No quests visible. Try widening the sidebar or selecting a workspace.');
        }
        return items.slice(0, limit).map((t, i) => ({ Index: i + 1, Title: t }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Widen the Qoder window or expand the sidebar so the Quest list is visible, then rerun.
  2. Select/create a workspace that contains quests (open Qoder manually and confirm quests are listed in the UI).
  3. Increase --limit is irrelevant here; instead verify in the UI that at least one quest exists — if it does, inspect the sidebar DOM class names and update the querySelectorAll selectors.
  4. Navigate Qoder back to a main/quest view (e.g. `qoder new` or clicking a quest) before running history, since some screens hide the list.

Example fix

// before
if (!items.length) {
    throw new EmptyResultError('qoder history', 'No quests visible. Try widening the sidebar or selecting a workspace.');
}
// after (caller-side retry after widening sidebar)
let items;
try {
    items = runCli('qoder history');
} catch (e) {
    await runCli('qoder open-panel'); // expand sidebar
    items = runCli('qoder history');
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify the sidebar quest list is visible before calling history
const listVisible = await page.evaluate(() =>
  !!document.querySelector('[class*="sidebar"i], [class*="quest-list"i], [class*="quest"i]')
);
if (!listVisible) throw new Error('Quest sidebar not visible — widen the window or open the panel first');

Type guard

function isEmptyStringArray(v) {
  return Array.isArray(v) && v.length === 0; // triggers EmptyResultError path
}

Try / catch

try {
  const quests = await runCli('qoder history');
  return quests;
} catch (e) {
  if (String(e.message).includes('No quests visible')) {
    await runCli('qoder open-panel'); // expand sidebar / select workspace
    return runCli('qoder history');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `qoder history` when: the Quest sidebar is collapsed or hidden by window width; no workspace is selected so the quest list is empty; the user is on a screen (e.g. Settings) where the sidebar quest list is not rendered; all scraped rows were filtered by the exclusion regex (menu items only); or class names like 'sidebar'/'quest' changed in a Qoder update so the querySelectorAll matches nothing.

Common situations: Narrow Qoder windows where the sidebar auto-collapses to icons; fresh installs with no quests yet; workspaces switched via CLI leaving the list empty; Qoder version bumps renaming CSS classes, breaking the [class*="sidebar"i] heuristic.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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