Repository navigation
Say where an app error happened: the route's pattern, languages, translation and browser - #2935
Open
davidmckayv wants to merge 2 commits into
Open
davidmckayv wants to merge 2 commits into
davidmckayv wants to merge 2 commits into
Conversation
…slation and browser Error reports reach PostHog through the server, so they carried the server's user agent and nothing of the browser. React's insertBefore/removeChild NotFoundError, almost certainly from page translators, could not be told apart from a bug or tied to a screen. AppError gains optional route (the matched route's pattern, never the address), pageLanguage, pageTranslated (Google's and Microsoft's translator marks), browserLanguage, and the browser's and OS's names and major versions (Bowser, with client hints for the OS version where Chromium has them). Each value is held to the spec's pattern and left out when it doesn't fit.
davidmckayv
requested review from
MikeRyanDev,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
December 4, 2026 13:22
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
The web app's error reports reach PostHog through OpenBot's own server, so they carry the server's user agent and nothing about the browser. React's
NotFoundError: Failed to execute 'insertBefore' on 'Node'(andremoveChild) has reached PostHog 8 times since 3 December, from Cloud and from Desktop installs in China, Brazil and Japan, and people land on "This page couldn't be shown". It is almost certainly a page translator rewriting the text React drew, but today's reports can't show that or say which screen it was.Each report now says where it happened, without saying who or what was on the page. All the new
AppErrorfields are optional:route/bots/$botIdpageLanguage<html lang>japageTranslatedtranslated-ltr/translated-rtlon<html>, Google's<font style="vertical-align…">wrappers, Microsoft's_msttexthashtruebrowserLanguagenavigator.languagept-BRbrowserName,browserVersionChrome,141osName,osVersionplatformVersionwhere Chromium has them (13 or more is Windows 11). Without hints it is sent only for iOS and Android, because every browser freezes the Windows and macOS versions in its user agent stringWindows,11Privacy. There are no addresses, query strings, fragments, IDs or page text, only the route's pattern, two language tags, a yes or no, and the browser's and OS's names and major versions. The app holds each value to the pattern the spec gives it and leaves out any value that doesn't fit, so a report is never refused because of them.
Bundle. The user agent parser is Bowser (MIT, about 100M downloads a week, last release November 2026). It loads in its own 7.6 KB gzipped chunk when reporting is installed, so the entry chunk doesn't grow.
How the leaders do it
/teams/:teamid/user/:userid), not by their address. Source: https://docs.sentry.io/platforms/javascript/guides/react/features/react-router/v6/browserandoscontexts (name and version) andculture.localeon each event. Source: https://develop.sentry.dev/sdk/data-model/event-payloads/contexts/$browser,$browser_version,$os,$os_version,$pathnameand$current_urlon every event. Source: https://posthog.com/docs/data/eventsmask_personal_data_properties). Source: https://posthog.com/docs/references/posthog-js/types/PostHogConfigTwo of the three group pages by their route's pattern rather than the raw URL, and all three attach the browser's and OS's names, versions and locale. This change follows them.
Chromium freezes the OS in its user agent string, so the version comes from client hints. Sources: https://developer.chrome.com/docs/privacy-security/user-agent-client-hints and https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11
API
The new fields are optional request fields on
AppError, which is additive under docs/api-and-migrations.md.oasdiffreports no breaking change, andapi:lintpasses.Only the web app sends
AppError, and its own server serves it. A server older than this spec refuses unknown fields in this body. So during a rolling upgrade, a page loaded from a newer server that reports to an older one loses that one report. Any new request field has the same window.Tests
app/tests/app-error-reporting-browser.test.tsruns in Chromium and WebKit. A screen under the app's router throws at/bots/bot_8f3a9c2e?q=private-search#section-2. The page is marked as Google Translate leaves it (<html lang="ja" class="translated-ltr">), and the browser preferspt-BR.route: "/bots/$botId",pageLanguage: "ja",pageTranslated: trueandbrowserLanguage: "pt-BR".ChromeorSafari) with its major version, and the OS.pageTranslated: false.Red/green, locally:
Changelog
API.
AppError(recordAppError,recordSignedOutAppError) takes optionalroute,pageLanguage,pageTranslated,browserLanguage,browserName,browserVersion,osNameandosVersion. They hold the route's pattern, never its address, and names and major versions, never a user agent string.Web app and OpenBot Desktop.