jackwener/OpenCLI · error · CommandExecutionError

Share button not visible

Error message

Share button not visible

What it means

Thrown by the kimi chat share command when page.evaluate(clickBySvgNameScript('Share_a')) fails to find or click the Share icon on the conversation page. Like the like/dislike handler, the CLI surfaces the page-side reason or the fallback 'Share button not visible'.

Source

Thrown at clis/kimi/chat.js:424

// -------- share --------
cli({
    site: 'kimi',
    name: 'share',
    access: 'write',
    description: 'Click Share on the last assistant message (opens Kimi\'s share dialog). Pass --conv <id> to target a specific chat.',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'conv', required: false, help: 'Chat id or URL' },
    ],
    columns: CHAT_COLUMNS,
    func: async (page, kwargs) => {
        await maybeNavigateConv(page, kwargs?.conv);
        const res = await page.evaluate(clickBySvgNameScript('Share_a'));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Share button not visible', '');
        await page.wait(1);
        return [{ Status: 'share dialog opened' }];
    },
});

// -------- ask --------
cli({
    site: 'kimi',
    name: 'ask',
    access: 'write',
    description: 'Send a message and wait up to --timeout seconds for the assistant reply (best-effort: polls for turn count to grow + stabilize).',
    domain: KIMI_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'text', positional: true, required: true, help: 'Prompt text' },

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the conversation URL is valid and the Share icon is visible in the browser before running the command
  2. Wait/retry after page load so the icon is rendered
  3. Check the DOM for the current Share SVG name and update the 'Share_a' argument if Kimi changed it
  4. Inspect res.reason in the error for the precise page-side failure

Example fix

// before
const res = await page.evaluate(clickBySvgNameScript('Share_a'));
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'Share button not visible', '');
// after
await page.wait(2); // ensure conversation UI is rendered
const res = await page.evaluate(clickBySvgNameScript('Share_a'));
if (!res?.ok) {
  // fall back to opening overflow menu if Kimi moved Share behind '...'
  const retry = await page.evaluate(clickBySvgNameScript('Share'));
  if (!retry?.ok) throw new CommandExecutionError(retry?.reason || res.reason, '');
}
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm you are on a conversation URL that supports share
if (!/kimi\.com.*conversation|chat/.test(page.url())) throw new Error('not on a shareable conversation page');

Type guard

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

Try / catch

try {
  await kimi(['chat', 'share']);
} catch (e) {
  if (/Share button not visible/.test(e.message)) {
    await page.wait(2);
    // retry or fall back to copying the conversation URL directly
    return page.url();
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the share command on a page where the 'Share_a' SVG is absent: not on a saved/shared conversation, the share icon is behind an overflow menu, the conv URL is wrong, or the page hasn't finished rendering.

Common situations: Attempting to share a fresh conversation where Kimi only shows Share after the conversation is saved, a Kimi UI update renaming the Share SVG, or navigation landed on the wrong page.

Related errors


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