Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(error-tracking): explain failed fetch errors (#113846)

Hugues Pouillot55cc5e3172ae
diff --git a/frontend/src/lib/components/Errors/Exception/known-exceptions/javascript/load-failed.tsx b/frontend/src/lib/components/Errors/Exception/known-exceptions/javascript/load-failed.tsx
index fd4dd69494fe..35f5a73d65eb 100644
--- a/frontend/src/lib/components/Errors/Exception/known-exceptions/javascript/load-failed.tsx
+++ b/frontend/src/lib/components/Errors/Exception/known-exceptions/javascript/load-failed.tsx
@@ -3,14 +3,16 @@ import { Link } from '@posthog/lemon-ui'
import { defineKnownException } from '../registry'
import { KnownExceptionBanner } from './base'
+const FETCH_FAILURE_MESSAGES = new Set(['Failed to fetch', 'Load failed'])
+
defineKnownException({
match(exception) {
- return exception.type === 'TypeError' && exception.value === 'Load failed'
+ return exception.type === 'TypeError' && FETCH_FAILURE_MESSAGES.has(exception.value)
},
- render() {
+ render(exception) {
return (
<KnownExceptionBanner>
- <strong>Load failed</strong> is the message Safari emits when a <code>fetch()</code> call cannot
+ <strong>{exception.value}</strong> is a message browsers emit when a <code>fetch()</code> call cannot
complete. Because it is thrown from native code, no JavaScript stack trace is captured. Common causes
are network errors, CORS misconfiguration, the request being aborted, or a browser extension blocking
the request.{' '}