jackwener/OpenCLI · error

NO_DIALOG

NO_DIALOG

Error message

NO_DIALOG

What it means

The grok export CLI clicked the history launcher and then polled up to 30 times (250ms apart) for a [role="listbox"] element containing at least one chat link a[href^="/c/"]. If the listbox never appears (or contains no chat links) within ~7.5s, it returns { ok:false, code:'NO_DIALOG' } and aborts the export.

Source

Thrown at clis/grok/export.js:90

          .filter((node) => node instanceof HTMLElement && isVisible(node));
        const target = buttons.find((node) => /^(查看全部|show all|view all)$/i.test((node.textContent || '').trim()));
        if (!target) return false;
        target.click();
        return true;
      };

      if (!document.querySelector('[role="listbox"] a[href^="/c/"]')) {
        clickAllHistory();
      }

      let listbox = null;
      for (let attempt = 0; attempt < 30; attempt += 1) {
        listbox = document.querySelector('[role="listbox"]');
        if (listbox && listbox.querySelector('a[href^="/c/"]')) break;
        await sleep(250);
      }
      if (!listbox || !listbox.querySelector('a[href^="/c/"]')) {
        return { ok: false, code: 'NO_DIALOG' };
      }

      const findScroller = () => {
        const nodes = Array.from(listbox.querySelectorAll('*'));
        return nodes.find((node) => node.scrollHeight > node.clientHeight + 20) || listbox;
      };
      const scroller = findScroller();
      const seen = new Map();
      const collect = () => {
        const anchors = Array.from(listbox.querySelectorAll('a[href^="/c/"]'));
        for (const a of anchors) {
          const href = a.getAttribute('href') || '';
          const match = href.match(/^\\/c\\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i);
          if (!match) continue;
          const id = match[1].toLowerCase();
          const option = a.closest('[role="option"]') || a.parentElement;
          const lines = (option?.innerText || option?.textContent || a.textContent || '')
            .split(/\\n+/)

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the export on a faster connection / wait for the page to fully load before starting
  2. Verify the account actually has chat history on grok.com and that clicking 'show all' opens the list manually
  3. Inspect the current Grok DOM: if the history dialog no longer uses role="listbox" or /c/ hrefs, update the selectors in clis/grok/export.js
  4. Increase the poll count/interval in the export script to tolerate slow renders

Example fix

// before
for (let attempt = 0; attempt < 30; attempt += 1) {
  listbox = document.querySelector('[role="listbox"]');
// after: wider selector + longer timeout
for (let attempt = 0; attempt < 60; attempt += 1) {
  listbox = document.querySelector('[role="listbox"], [role="dialog"], [data-testid="history-list"]');
Defensive patterns

Strategy: retry

Validate before calling

// pre-check that history exists before invoking the dialog flow
const hasHistory = await page.$$eval('a[href^="/c/"]', els => els.length > 0).catch(() => false);
if (!hasHistory) console.warn('No chat history anchors found; NO_DIALOG likely');

Type guard

function isNoDialog(r) { return r && r.ok === false && r.code === 'NO_DIALOG'; }

Try / catch

const res = await exportGrokChats();
if (isNoDialog(res)) {
  await sleep(2000); // allow slow render, retry once
  return exportGrokChats();
}

Prevention

When it happens

Trigger: Calling the grok history-export flow when clicking the 'show all / 查看全部' history button fails to open the history listbox, or the listbox opens but renders no /c/ chat anchors within the 30x250ms polling window.

Common situations: Grok UI changed so the history dropdown is no longer role="listbox"; slow network rendering leaves the dialog empty past the timeout; the click was swallowed by an overlay or animation; account genuinely has zero chat history so no /c/ anchors ever appear.

Related errors


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