You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
captureException: PostHog's own frames show up as the error location when the SDK is linked into the app #1077
Add posthog-ios to an iOS app so it's statically linked into the app's own binary (I saw it in a Debug build, where the module shows up as .debug.dylib)
Turn on error tracking and capture a handled error with PostHogSDK.shared.captureException(error)
Open the issue in Error Tracking and look at its location and the top of the stack trace
Expected Result
The SDK’s own frames get stripped from the top of the stack trace, like the captureCurrentStackTraceWithMetadata docstring says, so the issue points at the place in the app that called captureException and none of the SDK’s frames are marked in-app.
Actual Result
The SDK’s own frames stay on top of every handled error - six of them, from PostHogSDK.captureException down to PostHogStackTraceProcessor.captureCurrentStackTraceWithMetadata - and they’re all marked in_app: true with the app’s binary as the module, so the issue’s location is captureCurrentStackTraceWithMetadata and it looks like every error comes from PostHog.
From what I can tell it’s because isPostHogModule only skips frames whose module is called “PostHog”, and once the SDK is linked into the app its frames carry the app’s module name instead. They then get marked in-app because the default inAppIncludes adds the app’s executable name, which matches the app’s module as a prefix, and since the SDK and the app share a module there’s no in-app setting that separates them. The “strips PostHog frames from top of stack” test only checks that the top frame’s module isn’t “PostHog”, which is always true in this setup, so it wouldn’t catch it.
I used AI to help trace this through the SDK code, and checked the stack frames myself.
Activity
posthog commentedon Nov 15, 2026
PostHog self-driving picked up this issue. Status: Research is done.
Somebody may already be working on it, so ask before you start a fix.
Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a1dcab-8fe4-75df-8994-b6890816f8e2?link_source=github_comment
turnipdabeets commentedon Nov 15, 2026
Thanks for this report @seandph !
fix(error-tracking): start handled-error stack traces at the caller (…