{"record":{"id":"834bae1c04fcfe17","repo":"jackwener/OpenCLI","slug":"no-codex-diffs-were-visible-run-opencli-codex-sen","errorCode":null,"errorMessage":"No Codex diffs were visible. Run opencli codex send \"/review\" --pick \"Review Agent\" and retry.","messagePattern":"No Codex diffs were visible\\. Run opencli codex send \"/review\" --pick \"Review Agent\" and retry\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/codex/extract-diff.js","lineNumber":46,"sourceCode":"        // If no structured diffs found, try to find any code blocks labeled as patches\n        if (results.length === 0) {\n            const codeBlocks = document.querySelectorAll('pre code.language-diff, pre code.language-patch');\n            codeBlocks.forEach((code, index) => {\n                results.push({\n                    File: \\`Patch_\\${index+1}\\`,\n                    Diff: code.innerText || code.textContent\n                });\n            });\n        }\n        \n        return results;\n      })()\n    `));\n        if (!Array.isArray(diffs)) {\n            throw new CommandExecutionError('Codex extract-diff returned an invalid payload.');\n        }\n        if (diffs.length === 0) {\n            throw new EmptyResultError('codex extract-diff', 'No Codex diffs were visible. Run opencli codex send \"/review\" --pick \"Review Agent\" and retry.');\n        }\n        return diffs;\n    },\n});\n","sourceCodeStart":28,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/codex/extract-diff.js#L28-L51","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `opencli codex send \"/review\" --pick \"Review Agent\"` to generate a review, wait for it to finish, then retry extract-diff.","Confirm the review panel with visible diffs is open in the automated Codex tab before extracting.","Run `opencli codex list` / inspect the page to make sure you are pointed at the conversation containing the review.","If a review is visibly open but the error persists, the DOM selectors likely drifted after a Codex update — update opencli or its selectors."],"exampleFix":"// before\nopencli codex extract-diff   // fails when no review is open\n// after\nopencli codex send \"/review\" --pick \"Review Agent\" && opencli codex extract-diff","handlingStrategy":"validation","validationCode":"// ensure a review exists first\nawait run('opencli codex send \"/review\" --pick \"Review Agent\"');\n// then extract\nawait run('opencli codex extract-diff');","typeGuard":"function hasVisibleDiffs(page) {\n  return page.evaluate(`document.querySelectorAll('.diff-editor, .monaco-diff-editor, [data-testid=\"diff-view\"], pre code.language-diff, pre code.language-patch').length > 0`);\n}","tryCatchPattern":"try {\n  const diffs = await extractDiffs(page);\n} catch (err) {\n  if (err instanceof EmptyResultError) {\n    // no diffs rendered — trigger /review first, then retry\n  } else throw err;\n}","preventionTips":["Always run the /review command before extract-diff","Keep the review panel open in the automated Codex tab","Check you are on the conversation containing the review","Update selectors/opencli after Codex UI releases"],"tags":["empty-result","ui-scraping","codex","workflow-order"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}