jackwener/OpenCLI · warning · EmptyResultError

No Codex diffs were visible. Run opencli codex send "/review

Error message

No Codex diffs were visible. Run opencli codex send "/review" --pick "Review Agent" and retry.

What it means

`codex extract-diff` scrapes the Codex review UI for rendered diff blocks or patch code blocks. This EmptyResultError is thrown when the page was scraped successfully but the resulting array is empty — i.e., no diffs are currently rendered in the Codex UI. The library throws it (rather than returning an empty table) to force the caller to first generate a review via the Review Agent before extracting.

Source

Thrown at clis/codex/extract-diff.js:46

        // If no structured diffs found, try to find any code blocks labeled as patches
        if (results.length === 0) {
            const codeBlocks = document.querySelectorAll('pre code.language-diff, pre code.language-patch');
            codeBlocks.forEach((code, index) => {
                results.push({
                    File: \`Patch_\${index+1}\`,
                    Diff: code.innerText || code.textContent
                });
            });
        }
        
        return results;
      })()
    `));
        if (!Array.isArray(diffs)) {
            throw new CommandExecutionError('Codex extract-diff returned an invalid payload.');
        }
        if (diffs.length === 0) {
            throw new EmptyResultError('codex extract-diff', 'No Codex diffs were visible. Run opencli codex send "/review" --pick "Review Agent" and retry.');
        }
        return diffs;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli codex send "/review" --pick "Review Agent"` to generate a review, wait for it to finish, then retry extract-diff.
  2. Confirm the review panel with visible diffs is open in the automated Codex tab before extracting.
  3. Run `opencli codex list` / inspect the page to make sure you are pointed at the conversation containing the review.
  4. If a review is visibly open but the error persists, the DOM selectors likely drifted after a Codex update — update opencli or its selectors.

Example fix

// before
opencli codex extract-diff   // fails when no review is open
// after
opencli codex send "/review" --pick "Review Agent" && opencli codex extract-diff
Defensive patterns

Strategy: validation

Validate before calling

// ensure a review exists first
await run('opencli codex send "/review" --pick "Review Agent"');
// then extract
await run('opencli codex extract-diff');

Type guard

function hasVisibleDiffs(page) {
  return page.evaluate(`document.querySelectorAll('.diff-editor, .monaco-diff-editor, [data-testid="diff-view"], pre code.language-diff, pre code.language-patch').length > 0`);
}

Try / catch

try {
  const diffs = await extractDiffs(page);
} catch (err) {
  if (err instanceof EmptyResultError) {
    // no diffs rendered — trigger /review first, then retry
  } else throw err;
}

Prevention

When it happens

Trigger: Running `opencli codex extract-diff` when the injected querySelectors (`.diff-editor`, `.monaco-diff-editor`, `[data-testid="diff-view"]`, `pre code.language-diff`, `pre code.language-patch`) match zero visible elements — before any /review run has produced a diff view, or after the review panel was closed.

Common situations: Forgetting to run `opencli codex send "/review" --pick "Review Agent"` first; the Codex review finished but diffs were collapsed or closed; Codex changed its diff DOM classes so the scrapers no longer match; extracting from the wrong chat/tab with no review open.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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