Skip to content

fix: chrome web data network error display#1115

Open
RohitR311 wants to merge 1 commit into
developfrom
chrome-error
Open

fix: chrome web data network error display#1115
RohitR311 wants to merge 1 commit into
developfrom
chrome-error

Conversation

@RohitR311

@RohitR311 RohitR311 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

What this PR does?

Adds a simple error message in case of network or proxy errors (classic chrome web data error).

Summary by CodeRabbit

  • New Features
    • Added detection and handling for browser error pages, providing users with a clear visual indicator when errors occur.
    • Users can now dismiss error notifications or discard the session when browser errors are encountered.

@RohitR311 RohitR311 added Type: Bug Something isn't working Type: Enhancement Improvements to existing features labels Jun 19, 2026
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Chrome error page navigations (e.g., chrome-error://chromewebdata) are now intercepted server-side in both RemoteBrowser.setupPageEventListeners and handleChangeUrl. A new emitBrowserPageError method broadcasts a browser-page-error socket event. On the frontend, DOMBrowserRenderer listens for this event, tears down the rrweb replayer, and renders a dismissible ChromeWebErrorOverlay.

Changes

Chrome Error Page Detection and Overlay

Layer / File(s) Summary
Server-side Chrome error detection and emitBrowserPageError
server/src/browser-management/classes/RemoteBrowser.ts, server/src/browser-management/inputHandlers.ts
RemoteBrowser gains a public emitBrowserPageError(url, message) method that broadcasts urlChanged and emits browser-page-error over the socket. setupPageEventListeners short-circuits navigation handling when the main frame lands on a Chrome error URL. handleChangeUrl now calls page.goto explicitly and checks the resulting URL for Chrome error pages before continuing.
DOMBrowserRenderer error state and overlay UI
src/components/recorder/DOMBrowserRenderer.tsx
Adds browserPageError state, clears it on rrweb type-2 events, and registers a socket listener for browser-page-error that pauses/nulls the replayer, empties #replayer-root, and stores the error message. Conditionally renders ChromeWebErrorOverlay with a dismiss handler and a Discard button that fires a maxun:trigger-discard custom event.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • getmaxun/maxun#243: Modifies RemoteBrowser.setupPageEventListeners in the same navigation-event handling path where Chrome error detection is now inserted.
  • getmaxun/maxun#1082: Adds error/crash guards inside RemoteBrowser.setupPageEventListeners, the same method extended by this PR to handle Chrome error page navigations.

Suggested labels

Scope: UI/UX

Suggested reviewers

  • amhsirak

Poem

🐇 Hop hop, the browser went astray,
Chrome threw an error in my way!
I caught it server-side with care,
And sent a socket through the air.
Now overlays bloom where errors hide —
A discard button, my bunny pride! 🌸

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: chrome web data network error display' directly and accurately summarizes the main change: adding error message display for Chrome web data network errors across three modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chrome-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@server/src/browser-management/inputHandlers.ts`:
- Around line 315-320: The code is emitting a browser-page-error in the
navigation completion handler when a Chrome error page is detected, but
RemoteBrowser.setupPageEventListeners already emits the same error for this
scenario, causing duplicate emissions. Remove the
activeBrowser.emitBrowserPageError() call from this block (keeping only the
logger.warn line if desired) since the error handling is already managed
elsewhere in the event listener setup.

In `@src/components/recorder/DOMBrowserRenderer.tsx`:
- Around line 948-953: The ChromeWebErrorOverlay component receives an onDismiss
callback prop from its parent but never invokes it, leaving the error overlay
undismissible and users stuck behind the blocking layer. Add a control (such as
a close button) within the ChromeWebErrorOverlay component that calls the
onDismiss callback when clicked to allow users to dismiss the error overlay.
- Around line 914-918: The DOM cleanup in the replayer initialization is
targeting the wrong element selector. The replayer is mounted in the
`#mirror-container` element, but the cleanup code is querying for `#replayer-root`
instead. Update the querySelector call in the cleanup block to target
`#mirror-container` instead of `#replayer-root` so that stale rrweb wrappers are
properly removed and don't accumulate on re-initialization.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1967fbf3-fead-4c8e-876f-38f300644726

📥 Commits

Reviewing files that changed from the base of the PR and between d581502 and 8e05672.

📒 Files selected for processing (3)
  • server/src/browser-management/classes/RemoteBrowser.ts
  • server/src/browser-management/inputHandlers.ts
  • src/components/recorder/DOMBrowserRenderer.tsx

Comment on lines +315 to +320
const finalUrl = page.url();
if (finalUrl.startsWith('chrome-error://') || finalUrl.startsWith('chrome://chromewebdata')) {
logger.warn(`Navigation to ${url} silently landed on chrome error page: ${finalUrl}`);
activeBrowser.emitBrowserPageError(url, 'The page failed to load due to a network error. Please try again later.');
return;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid double-emitting browser-page-error for one failed navigation.

RemoteBrowser.setupPageEventListeners already emits this error on main-frame navigation to Chrome error pages. Emitting again here can fire duplicate overlays and conflicting urlChanged payloads.

Suggested fix
-                const finalUrl = page.url();
-                if (finalUrl.startsWith('chrome-error://') || finalUrl.startsWith('chrome://chromewebdata')) {
-                  logger.warn(`Navigation to ${url} silently landed on chrome error page: ${finalUrl}`);
-                  activeBrowser.emitBrowserPageError(url, 'The page failed to load due to a network error. Please try again later.');
-                  return;
-                }
+                const finalUrl = page.url();
+                if (finalUrl.startsWith('chrome-error://') || finalUrl.startsWith('chrome://chromewebdata')) {
+                  logger.warn(`Navigation to ${url} silently landed on chrome error page: ${finalUrl}`);
+                  // Error emission is already handled by RemoteBrowser.setupPageEventListeners(framenavigated).
+                  return;
+                }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/src/browser-management/inputHandlers.ts` around lines 315 - 320, The
code is emitting a browser-page-error in the navigation completion handler when
a Chrome error page is detected, but RemoteBrowser.setupPageEventListeners
already emits the same error for this scenario, causing duplicate emissions.
Remove the activeBrowser.emitBrowserPageError() call from this block (keeping
only the logger.warn line if desired) since the error handling is already
managed elsewhere in the event listener setup.

Comment on lines +914 to +918
const container = containerRef.current;
if (container) {
const replayerRoot = container.querySelector('#replayer-root') as HTMLElement;
if (replayerRoot) replayerRoot.innerHTML = '';
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replayer DOM cleanup targets the wrong node.

Replayer is mounted in #mirror-container, but cleanup looks for #replayer-root, so stale rrweb wrappers can remain and stack on re-init.

Suggested fix
       const container = containerRef.current;
       if (container) {
-        const replayerRoot = container.querySelector('`#replayer-root`') as HTMLElement;
-        if (replayerRoot) replayerRoot.innerHTML = '';
+        container.querySelectorAll('.replayer-wrapper').forEach((node) => node.remove());
       }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/recorder/DOMBrowserRenderer.tsx` around lines 914 - 918, The
DOM cleanup in the replayer initialization is targeting the wrong element
selector. The replayer is mounted in the `#mirror-container` element, but the
cleanup code is querying for `#replayer-root` instead. Update the querySelector
call in the cleanup block to target `#mirror-container` instead of `#replayer-root`
so that stale rrweb wrappers are properly removed and don't accumulate on
re-initialization.

Comment on lines +948 to +953
{browserPageError && (
<ChromeWebErrorOverlay
message={browserPageError.message}
onDismiss={() => setBrowserPageError(null)}
/>
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Overlay is not actually dismissible (onDismiss is never used).

The parent passes onDismiss, but the overlay has no control that invokes it, so users can get stuck behind the blocking layer unless a new rrweb snapshot arrives.

Suggested fix
       <div style={{ display: "flex", gap: "10px", marginTop: "8px" }}>
+        <button
+          onClick={onDismiss}
+          style={{
+            padding: "8px 20px",
+            background: "`#ffffff`",
+            color: "`#333`",
+            border: "1px solid `#d0d0d0`",
+            borderRadius: "6px",
+            fontSize: "14px",
+            fontWeight: "500",
+            cursor: "pointer",
+          }}
+        >
+          Dismiss
+        </button>
         <button
           onClick={() => {
             window.dispatchEvent(new CustomEvent('maxun:trigger-discard'));
           }}

Also applies to: 958-1035

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/recorder/DOMBrowserRenderer.tsx` around lines 948 - 953, The
ChromeWebErrorOverlay component receives an onDismiss callback prop from its
parent but never invokes it, leaving the error overlay undismissible and users
stuck behind the blocking layer. Add a control (such as a close button) within
the ChromeWebErrorOverlay component that calls the onDismiss callback when
clicked to allow users to dismiss the error overlay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Something isn't working Type: Enhancement Improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant