{"record":{"id":"cd8136bbe2a03220","repo":"jackwener/OpenCLI","slug":"no-template-cards-visible-are-you-on-a-mode-page","errorCode":null,"errorMessage":"No template cards visible. Are you on a mode page?","messagePattern":"No template cards visible\\. Are you on a mode page\\?","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/kimi/audit-extras.js","lineNumber":187,"sourceCode":"      const out = [];\n      for (const el of els) {\n        const tx = (el.innerText || '').trim();\n        // Match \"category\\\\n\\\\ntitle\" or \"category\\\\ntitle\" patterns\n        const m = tx.match(/^([^\\\\n]+)\\\\n+(.+)$/);\n        if (m && m[1].length < 30 && m[2].length < 100 && m[1] !== m[2]) {\n          out.push({ category: m[1].trim(), title: m[2].trim() });\n        }\n      }\n      // Dedupe by title\n      const seen = new Set();\n      return out.filter((c) => {\n        if (seen.has(c.title)) return false;\n        seen.add(c.title);\n        return true;\n      });\n    })()`);\n        if (!cards.length) {\n            throw new EmptyResultError('kimi templates', 'No template cards visible. Are you on a mode page?');\n        }\n        const limit = Number.isInteger(kwargs?.limit) && kwargs.limit > 0 ? kwargs.limit : 30;\n        return cards.slice(0, limit).map((c, i) => ({ Index: i + 1, Category: c.category, Title: c.title }));\n    },\n});\n\n// -------- history-rename --------\ncli({\n    site: 'kimi',\n    name: 'history-rename',\n    access: 'write',\n    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.',\n    domain: KIMI_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/kimi/audit-extras.js#L169-L205","documentation":"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?').","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Pass an explicit --mode (e.g. ppt, docs, deep-research, agent) so the command navigates to a page that shows template cards","Increase the wait and retry — the SPA may need longer than 2s to render cards","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","Confirm you are signed in and the page is not showing a login/risk-control wall"],"exampleFix":"// before\nawait runCli('kimi templates');\n// after\ntry {\n  return await runCli('kimi templates', { mode: 'ppt' });\n} catch (e) {\n  if (e.name === 'EmptyResultError') { await sleep(3); return await runCli('kimi templates', { mode: 'docs' }); }\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"// ensure a mode page is loaded before scraping\nawait page.evaluate(() => !window.location.pathname.startsWith('/chat')) || await page.goto('https://kimi.com/slides');\nawait page.waitForSelector('a, [role=\"button\"]', { timeout: 10000 });","typeGuard":"function hasCards(cards) { return Array.isArray(cards) && cards.length > 0; }","tryCatchPattern":"try {\n  const rows = await runCli('kimi templates', { mode: 'ppt' });\n} catch (e) {\n  if (e.name === 'EmptyResultError' || /No template cards/i.test(e.message)) {\n    await sleep(3000);\n    return runCli('kimi templates', { mode: 'docs' }); // fallback mode\n  }\n  throw e;\n}","preventionTips":["Always pass an explicit --mode for deterministic navigation","Allow longer waits than the default 2s on slow networks","Verify sign-in state — logged-out pages show no cards","Re-check the 'category\\ntitle' text heuristic after Kimi redesigns"],"tags":["browser-automation","dom-selector","empty-result"],"backgroundTag":"empty-scrape-result","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}