Skip to content

captureException: PostHog's own frames show up as the error location when the SDK is linked into the app #1077

Closed

Description

@seandph

Version

3.93.6

Steps to Reproduce

  1. 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)
  2. Turn on error tracking and capture a handled error with PostHogSDK.shared.captureException(error)
  3. 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

  1. posthog commented on Nov 15, 2026

    @posthog
    Contributor

    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

  2. turnipdabeets commented on Nov 15, 2026

    @turnipdabeets
    Contributor

    Thanks for this report @seandph !

  3. added a commit that references this issue on Nov 16, 2026
    8ee4863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions