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): render frames that carry only an instruction address (#83585)

Aleksander Błaszkiewicz14951ccebc57
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index bce66e72fdb7..5b8bf111c3db 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -456,6 +456,18 @@ snapshots:
hash: v1.k794b7964.bea8ab7e39a8364ee26cc117d93a1c4c8a9d6aee90928113f5fd507a60f9d399.oqTYgnhSacabZyhWq8SDsXiQpaJXzWriZDi1y1XQk0w
components-entity-filter-info--renamed-and-unrenamed-series--light:
hash: v1.k794b7964.ca3a8526ed0f7eee16a57c00f6ff34c17e75dd87642df8ec00a82036aca1f888.VtepH22TkcZm4dNfLA3NUjfX4s-z36MVDpovsBDrBn4
+ components-errors-collapsibleframe--address-only-frame--dark:
+ hash: v1.k794b7964.764bee1a1f92990059850229d74ee0ee56ea720031f16b60bf4273d1e0a53d72.u9jvDd7D0YxIPoUD7CFtUXhecwsjBWgZd4mt_txOdu4
+ components-errors-collapsibleframe--address-only-frame--light:
+ hash: v1.k794b7964.e221cce9ad5914b1d62c217f9bb4cb079931f050ecb02eff9bdd550084b268a1.TdQJR8wE1qmGw9-cmmxug_C0KNI0olkCBu1Xxy1vv58
+ components-errors-collapsibleframe--address-only-in-app-frame--dark:
+ hash: v1.k794b7964.807a1fca2bafb87ab74f30d54fe2b073a0b67f05182414ec21a2a7280fc1de46.TemjUeqayfSGt17ogettmJD4509JgvACgaVe4T7dcOc
+ components-errors-collapsibleframe--address-only-in-app-frame--light:
+ hash: v1.k794b7964.645532c9e2546d984d69ddb9fb872e4baff12ef2c0f50e237b2877ee1c72c8bb.lU20pRlv77T8eVRWYoiiGFreBoNPm9fJjzSvv_aH50g
+ components-errors-collapsibleframe--frame-with-nothing-to-show--dark:
+ hash: v1.k794b7964.289024ecaf031e227c7bc4a12f6c6a5e860ead79c2ec02c99c1d3089c6c10434.D-6341XMlEgmejrfOD7-K9TwmyV8NwwePIr18vzNdSk
+ components-errors-collapsibleframe--frame-with-nothing-to-show--light:
+ hash: v1.k794b7964.3654379c6e5e20c68e518289d0a0c883853132a2880817ff7951ba583251717b.nzLVc55TNu67bPmEyNKgo6x12j5Ug_ajNJWC8eEw08s
components-errors-collapsibleframe--in-app-with-context--dark:
hash: v1.k794b7964.4a596c0a7adc41c4f97db6bcaa331b46080055c20112bcfffe763d8a45f339ba.BENAvO3_UdIV1Js2Q8NT06JMyXOLFEYGsc2OE6rl5dA
components-errors-collapsibleframe--in-app-with-context--light:
diff --git a/frontend/src/lib/components/Errors/Frame/CollapsibleFrame.stories.tsx b/frontend/src/lib/components/Errors/Frame/CollapsibleFrame.stories.tsx
index ce29a6509305..487b0c13e1a1 100644
--- a/frontend/src/lib/components/Errors/Frame/CollapsibleFrame.stories.tsx
+++ b/frontend/src/lib/components/Errors/Frame/CollapsibleFrame.stories.tsx
@@ -153,6 +153,33 @@ export function UnresolvedFrame(): JSX.Element {
)
}
+const addressOnlyFrame: ErrorTrackingStackFrame = {
+ raw_id: 'address-only-1',
+ mangled_name: '',
+ line: null,
+ column: null,
+ source: null,
+ in_app: false,
+ resolved_name: null,
+ lang: 'swift',
+ resolved: false,
+ resolve_failure: 'No matching debug image found for frame',
+ module: null,
+ junk_drawer: { raw_frame: { instruction_addr: '0x00000001010444e4' } },
+}
+
+export function AddressOnlyFrame(): JSX.Element {
+ return <Wrapper frame={addressOnlyFrame} />
+}
+
+export function AddressOnlyInAppFrame(): JSX.Element {
+ return <Wrapper frame={{ ...addressOnlyFrame, raw_id: 'address-only-2', in_app: true }} />
+}
+
+export function FrameWithNothingToShow(): JSX.Element {
+ return <Wrapper frame={{ ...addressOnlyFrame, raw_id: 'nothing-1', junk_drawer: undefined }} />
+}
+
const rustFrame: ErrorTrackingStackFrame = {
...baseFrame,
raw_id: 'rust-1',
diff --git a/frontend/src/lib/components/Errors/Frame/CollapsibleFrameHeader.tsx b/frontend/src/lib/components/Errors/Frame/CollapsibleFrameHeader.tsx
index ab7c1c23876c..549ec951b35a 100644
--- a/frontend/src/lib/components/Errors/Frame/CollapsibleFrameHeader.tsx
+++ b/frontend/src/lib/components/Errors/Frame/CollapsibleFrameHeader.tsx
@@ -2,7 +2,7 @@ import './CollapsibleFrameHeader.scss'
import { useValues } from 'kea'
import posthog from 'posthog-js'
-import { useEffect, useRef } from 'react'
+import { ReactNode, useEffect, useRef } from 'react'
import { P, match } from 'ts-pattern'
import { IconBox, IconEllipsis, IconSpinner, IconWarning } from '@posthog/icons'
@@ -14,9 +14,12 @@ import { cn } from 'lib/utils/css-classes'
import { errorPropertiesLogic } from '../errorPropertiesLogic'
import { FingerprintRecordPartDisplay } from '../FingerprintRecordPartDisplay'
import { ErrorTrackingStackFrame, ErrorTrackingStackFrameRecord } from '../types'
-import { formatFunctionName } from '../utils'
+import { formatFunctionName, getInstructionAddress } from '../utils'
import { FrameDropDownMenu } from './FrameDropDownMenu'
+const UNKNOWN_FRAME_LABEL = 'Unknown frame'
+const SYMBOL_SETS_DOC_LINK = 'https://posthog.com/docs/error-tracking/upload-source-maps'
+
export function CollapsibleFrameHeader({
frame,
record,
@@ -35,7 +38,10 @@ export function CollapsibleFrameHeader({
const hasRecordContext = !!record && !!record.context
const sourceRef = useRef<HTMLSpanElement>(null)
const functionRef = useRef<HTMLSpanElement>(null)
- const sourceContent = formatSourceLine(source, line, column)
+ const sourceLine = formatSourceLine(source, line, column)
+ const instructionAddress = getInstructionAddress(frame)
+ const isUnsymbolicated = !functionName && !sourceLine
+ const sourceContent = sourceLine ?? instructionAddress ?? (functionName ? undefined : UNKNOWN_FRAME_LABEL)
useEffect(() => {
// If sourceRef is scrollable scroll to the end and add scrollable attribute
@@ -69,17 +75,33 @@ export function CollapsibleFrameHeader({
{functionName}
</span>
)}
- <span ref={sourceRef} className="font-light frame-source px-1" title={sourceContent!}>
+ <span
+ ref={sourceRef}
+ className={cn('font-light frame-source px-1', {
+ 'italic text-muted-foreground': isUnsymbolicated,
+ })}
+ title={sourceContent!}
+ >
{sourceContent}
</span>
<div className="gap-x-1 frame-icons">
{part && <FingerprintRecordPartDisplay part={part} />}
- {match([in_app, resolved, recordLoading, hasRecordContext])
- .with([false, P.any, P.any, P.any], () => <VendorIcon />)
- .with([true, false, P.any, P.any], () => <UnresolvedIcon resolve_failure={resolve_failure} />)
- .with([true, true, true, false], () => <SpinnerIcon />)
- .with([true, true, false, false], () => <NoContextIcon lang={lang} raw_id={raw_id} />)
- .otherwise(() => null)}
+ {isUnsymbolicated ? (
+ <UnsymbolicatedIcon
+ in_app={in_app}
+ resolve_failure={resolve_failure}
+ instructionAddress={instructionAddress}
+ />
+ ) : (
+ match([in_app, resolved, recordLoading, hasRecordContext])
+ .with([false, P.any, P.any, P.any], () => <VendorIcon />)
+ .with([true, false, P.any, P.any], () => (
+ <UnresolvedIcon resolve_failure={resolve_failure} />
+ ))
+ .with([true, true, true, false], () => <SpinnerIcon />)
+ .with([true, true, false, false], () => <NoContextIcon lang={lang} raw_id={raw_id} />)
+ .otherwise(() => null)
+ )}
</div>
</Collapsible.Trigger>
<div className="border-l-1 border-l-[color:var(--frame-border,var(--color-border-primary))] shrink-0 w-7">
@@ -91,6 +113,35 @@ export function CollapsibleFrameHeader({
)
}
+function FrameWarningIcon({
+ title,
+ severity,
+ docLink,
+ resolveFailure,
+ children,
+}: {
+ title: string
+ severity: 'error' | 'muted'
+ docLink?: string
+ resolveFailure?: string | null
+ children: ReactNode
+}): JSX.Element {
+ return (
+ <Tooltip
+ title={
+ <>
+ <h5>{title}</h5>
+ {children}
+ {resolveFailure && <p className="text-xs text-muted-foreground">{resolveFailure}</p>}
+ </>
+ }
+ docLink={docLink}
+ >
+ <IconWarning className={severity === 'error' ? 'text-red-500' : 'text-muted-foreground'} fontSize={15} />
+ </Tooltip>
+ )
+}
+
function NoContextIcon({ lang, raw_id }: { lang: string; raw_id: string }): JSX.Element {
useEffect(() => {
posthog.capture('error_tracking_frame_missing_content', {
@@ -100,16 +151,41 @@ function NoContextIcon({ lang, raw_id }: { lang: string; raw_id: string }): JSX.
}, [raw_id, lang])
return (
- <Tooltip
- title={
+ <FrameWarningIcon title="Missing Context" severity="error">
+ <p>Frame is resolved but source code is not available.</p>
+ </FrameWarningIcon>
+ )
+}
+
+function UnsymbolicatedIcon({
+ in_app,
+ resolve_failure,
+ instructionAddress,
+}: {
+ in_app: boolean
+ resolve_failure: string | null
+ instructionAddress: string | null
+}): JSX.Element {
+ return (
+ <FrameWarningIcon
+ title={UNKNOWN_FRAME_LABEL}
+ severity={in_app ? 'error' : 'muted'}
+ // Symbol sets are only actionable when we have an address to match them against
+ docLink={instructionAddress ? SYMBOL_SETS_DOC_LINK : undefined}
+ resolveFailure={resolve_failure}
+ >
+ {instructionAddress ? (
<>
- <h5>Missing Context</h5>
- <p>Frame is resolved but source code is not available.</p>
+ <p>The SDK sent only a memory address for this frame.</p>
+ <p>PostHog couldn't resolve that address to a function or file name.</p>
</>
- }
- >
- <IconWarning className="text-red-500" fontSize={15} />
- </Tooltip>
+ ) : (
+ <p>
+ The SDK sent no function name, file name or memory address for this frame, so there is nothing to
+ identify it with.
+ </p>
+ )}
+ </FrameWarningIcon>
)
}
@@ -131,21 +207,17 @@ function VendorIcon(): JSX.Element {
function UnresolvedIcon({ resolve_failure }: { resolve_failure: string | null }): JSX.Element {
return (
- <Tooltip
- title={
- <>
- <h5>Unresolved frame</h5>
- <p>
- Upload your symbol sets to improve issue grouping, see unminified source code and get release
- information.
- </p>
- <p className="text-xs text-muted-foreground">{resolve_failure}</p>
- </>
- }
- docLink="https://posthog.com/docs/error-tracking/upload-source-maps"
+ <FrameWarningIcon
+ title="Unresolved frame"
+ severity="muted"
+ docLink={SYMBOL_SETS_DOC_LINK}
+ resolveFailure={resolve_failure}
>
- <IconWarning className="text-muted-foreground" fontSize={15} />
- </Tooltip>
+ <p>
+ Upload your symbol sets to improve issue grouping, see unminified source code and get release
+ information.
+ </p>
+ </FrameWarningIcon>
)
}
diff --git a/frontend/src/lib/components/Errors/Frame/FrameDropDownMenu.tsx b/frontend/src/lib/components/Errors/Frame/FrameDropDownMenu.tsx
index cb24ef77a36a..386e5ad29ff0 100644
--- a/frontend/src/lib/components/Errors/Frame/FrameDropDownMenu.tsx
+++ b/frontend/src/lib/components/Errors/Frame/FrameDropDownMenu.tsx
@@ -30,6 +30,16 @@ export function FrameDropDownMenu({
const { getSourceDataForFrame } = useValues(framesCodeSourceLogic)
const sourceData = getSourceDataForFrame(raw_id)
const lineLocation = getLineLocation(frame)
+ const hasItems = !!(frame.resolved_name || frame.source || lineLocation || sourceData)
+
+ if (!hasItems) {
+ return (
+ <ButtonPrimitive className={className} disabled>
+ {children}
+ </ButtonPrimitive>
+ )
+ }
+
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
diff --git a/frontend/src/lib/components/Errors/types.ts b/frontend/src/lib/components/Errors/types.ts
index e2f76868b0ab..3ba0455f55b4 100644
--- a/frontend/src/lib/components/Errors/types.ts
+++ b/frontend/src/lib/components/Errors/types.ts
@@ -62,6 +62,12 @@ export type ErrorTrackingStackFrameContext = {
}
export type ErrorTrackingStackFrameContextLine = { number: number; line: string }
+export interface ErrorTrackingStackFrameJunkDrawer {
+ raw_frame?: {
+ instruction_addr?: string | null
+ }
+}
+
export interface ErrorTrackingStackFrame {
raw_id: string
mangled_name: string
@@ -75,6 +81,7 @@ export interface ErrorTrackingStackFrame {
resolve_failure: string | null
module: string | null
code_variables?: Record<string, unknown>
+ junk_drawer?: ErrorTrackingStackFrameJunkDrawer
}
export interface ErrorTrackingFingerprint {
diff --git a/frontend/src/lib/components/Errors/utils.test.ts b/frontend/src/lib/components/Errors/utils.test.ts
index f8ef41b9468c..5fff5560f897 100644
--- a/frontend/src/lib/components/Errors/utils.test.ts
+++ b/frontend/src/lib/components/Errors/utils.test.ts
@@ -1,5 +1,11 @@
-import { ErrorEventProperties, ExceptionAttributes } from './types'
-import { getExceptionAttributes, getExceptionList, getExceptionRelease, getSessionId } from './utils'
+import { ErrorEventProperties, ErrorTrackingStackFrame, ExceptionAttributes } from './types'
+import {
+ getExceptionAttributes,
+ getExceptionList,
+ getExceptionRelease,
+ getInstructionAddress,
+ getSessionId,
+} from './utils'
describe('Error Display', () => {
it('can read sentry stack trace when $exception_list is not present', () => {
@@ -228,4 +234,17 @@ describe('Error Display', () => {
])('ignores an invalid %s', (_name, properties) => {
expect(getExceptionRelease(properties as ErrorEventProperties)).toBeUndefined()
})
+
+ it.each([
+ ['an apple frame', { raw_frame: { instruction_addr: '0x00000001010444e4' } }, '0x00000001010444e4'],
+ ['a frame with no junk drawer', undefined, null],
+ ['a junk drawer with no raw frame', {}, null],
+ ['a raw frame with no address', { raw_frame: { colno: 12 } }, null],
+ ['a null address', { raw_frame: { instruction_addr: null } }, null],
+ ['a non-string address', { raw_frame: { instruction_addr: 4311089892 } }, null],
+ ['a whitespace-only address', { raw_frame: { instruction_addr: ' ' } }, null],
+ ['a padded address', { raw_frame: { instruction_addr: ' 0x00000001010444e4 ' } }, '0x00000001010444e4'],
+ ])('reads the instruction address from %s', (_name, junk_drawer, expected) => {
+ expect(getInstructionAddress({ junk_drawer } as ErrorTrackingStackFrame)).toEqual(expected)
+ })
})
diff --git a/frontend/src/lib/components/Errors/utils.ts b/frontend/src/lib/components/Errors/utils.ts
index 7b448adff77b..44cfa6448d10 100644
--- a/frontend/src/lib/components/Errors/utils.ts
+++ b/frontend/src/lib/components/Errors/utils.ts
@@ -266,6 +266,16 @@ export function formatFunctionName(
.otherwise(() => functionName)
}
+export function getInstructionAddress(frame: Pick<ErrorTrackingStackFrame, 'junk_drawer'>): string | null {
+ const address = frame.junk_drawer?.raw_frame?.instruction_addr
+ if (typeof address !== 'string') {
+ return null
+ }
+ // SDKs can send a padded or blank address, which would render as an empty frame row
+ const trimmed = address.trim()
+ return trimmed.length > 0 ? trimmed : null
+}
+
export function formatResolvedName(
frame: Pick<ErrorTrackingStackFrame, 'module' | 'resolved_name' | 'lang'>
): string | null {