jackwener/OpenCLI · error · CommandExecutionError

LeftBar svg not visible

Error message

LeftBar svg not visible

What it means

The toggle-sidebar command injects a script that locates the SVG icon named 'LeftBar' on the Kimi page and clicks it. If the script reports failure (res.ok false), the command throws CommandExecutionError with the script's reason, defaulting to 'LeftBar svg not visible'. The library throws this because the DOM element needed to toggle the sidebar could not be found or is not visible/clickable.

Source

Thrown at clis/kimi/ui.js:84

});

// -------- sidebar-toggle --------
cli({
    site: 'kimi',
    name: 'sidebar-toggle',
    access: 'write',
    description: 'Click the LeftBar svg to toggle the Kimi sidebar.',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [],
    columns: UI_COLUMNS,
    func: async (page) => {
        await ensureOnKimi(page);
        const res = await page.evaluate(clickBySvgNameScript('LeftBar', { last: false }));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'LeftBar svg not visible', '');
        return [{ Status: 'toggled' }];
    },
});

// -------- view-all-history --------
cli({
    site: 'kimi',
    name: 'view-all-history',
    access: 'write',
    description: 'Navigate to /chat/history (full conversation list page).',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [],
    columns: UI_COLUMNS,
    func: async (page) => {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Add a short wait or wait-for-selector after ensureOnKimi/page.goto before toggling so the icon has rendered.
  2. Verify you are on a Kimi page that actually renders the LeftBar icon (not a login or error page).
  3. Update the library if Kimi changed its icon names.
  4. Retry the command once — transient render timing is a common cause.

Example fix

// before
await page.evaluate(clickBySvgNameScript('LeftBar', { last: false }));
// after
await page.wait(1); // let the UI render
const res = await page.evaluate(clickBySvgNameScript('LeftBar', { last: false }));
if (!res?.ok) throw new Error(res?.reason);
Defensive patterns

Strategy: retry

Validate before calling

// wait until the icon exists before toggling
await page.waitForSelector('svg[name="LeftBar"]');

Type guard

const isClickResult = (r) => !!r && typeof r === 'object' && r.ok === true;

Try / catch

try {
  return await toggleSidebar(page);
} catch (e) {
  if (/LeftBar svg not visible/.test(e.message)) {
    await page.wait(1);
    return await toggleSidebar(page);
  }
  throw e;
}

Prevention

When it happens

Trigger: page.evaluate(clickBySvgNameScript('LeftBar')) returns { ok:false } — the LeftBar svg is absent, hidden (display:none/zero size), or inside a collapsed header at the time of the click.

Common situations: Kimi UI updated and renamed the icon; page not fully rendered yet (invoked right after navigation without waiting); browser window too narrow so the sidebar toggle is replaced by a different layout; already-on-kimi check passed but the page is an error/blank state.

Related errors


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