jackwener/OpenCLI · error · EmptyResultError

No template cards visible. Are you on a mode page?

Error message

No template cards visible. Are you on a mode page?

What it means

The kimi templates command scrapes visible anchor/button elements whose text matches a 'category\ntitle' pattern on a Kimi mode page. If no elements match after dedupe, it throws EmptyResultError('kimi templates', 'No template cards visible. Are you on a mode page?').

Source

Thrown at clis/kimi/audit-extras.js:187

      const out = [];
      for (const el of els) {
        const tx = (el.innerText || '').trim();
        // Match "category\\n\\ntitle" or "category\\ntitle" patterns
        const m = tx.match(/^([^\\n]+)\\n+(.+)$/);
        if (m && m[1].length < 30 && m[2].length < 100 && m[1] !== m[2]) {
          out.push({ category: m[1].trim(), title: m[2].trim() });
        }
      }
      // Dedupe by title
      const seen = new Set();
      return out.filter((c) => {
        if (seen.has(c.title)) return false;
        seen.add(c.title);
        return true;
      });
    })()`);
        if (!cards.length) {
            throw new EmptyResultError('kimi templates', 'No template cards visible. Are you on a mode page?');
        }
        const limit = Number.isInteger(kwargs?.limit) && kwargs.limit > 0 ? kwargs.limit : 30;
        return cards.slice(0, limit).map((c, i) => ({ Index: i + 1, Category: c.category, Title: c.title }));
    },
});

// -------- history-rename --------
cli({
    site: 'kimi',
    name: 'history-rename',
    access: 'write',
    description: 'Rename a chat from the /chat/history page (clicks the inline Edit svg next to a chat row, types the new title, and saves). Requires --yes.',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass an explicit --mode (e.g. ppt, docs, deep-research, agent) so the command navigates to a page that shows template cards
  2. Increase the wait and retry — the SPA may need longer than 2s to render cards
  3. Verify in a real browser that template cards appear on that page and match the 'category\ntitle' text pattern; if Kimi changed the DOM, update the scraping heuristic
  4. Confirm you are signed in and the page is not showing a login/risk-control wall

Example fix

// before
await runCli('kimi templates');
// after
try {
  return await runCli('kimi templates', { mode: 'ppt' });
} catch (e) {
  if (e.name === 'EmptyResultError') { await sleep(3); return await runCli('kimi templates', { mode: 'docs' }); }
  throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

// ensure a mode page is loaded before scraping
await page.evaluate(() => !window.location.pathname.startsWith('/chat')) || await page.goto('https://kimi.com/slides');
await page.waitForSelector('a, [role="button"]', { timeout: 10000 });

Type guard

function hasCards(cards) { return Array.isArray(cards) && cards.length > 0; }

Try / catch

try {
  const rows = await runCli('kimi templates', { mode: 'ppt' });
} catch (e) {
  if (e.name === 'EmptyResultError' || /No template cards/i.test(e.message)) {
    await sleep(3000);
    return runCli('kimi templates', { mode: 'docs' }); // fallback mode
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `kimi templates` while on the plain chat page (no mode selected), on a mode page that hasn't finished rendering within the fixed wait, when logged out, or when Kimi redesigned the card DOM so the text no longer matches 'category\n+title'.

Common situations: Forgetting --mode on a fresh session that lands on kimi.com chat home; slow network so the 2s page.wait expired before cards mounted; empty/new account with no curated templates shown; A/B layout change breaking the regex heuristic.

Related errors


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