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(ingestion): attribute person opt-out drops to the team setting (#104666)

Eli Reisman5476b4680179
diff --git a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
index 486345550c30..0899167f1906 100644
--- a/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
+++ b/frontend/src/scenes/data-management/ingestion-warnings/IngestionWarningsView.tsx
@@ -41,6 +41,10 @@ export const WARNING_TYPE_TO_DESCRIPTION: Record<string, string> = {
schema_validation_failed: 'Event rejected due to schema validation failure',
invalid_heatmap_data: 'Invalid heatmap data',
invalid_group_set: 'Discarded a $groupidentify event whose $group_set is not an object',
+ invalid_event_when_process_person_profile_is_false:
+ 'Discarded an event that requires person processing because $process_person_profile was set to false',
+ event_dropped_person_processing_disabled:
+ 'Discarded an event that requires person processing, which is turned off for this project',
cookieless_team_disabled: 'Discarded cookieless event because cookieless tracking is disabled',
// Emitted by the capture service when it drops events at validation time
missing_event_name: 'Discarded event with no event name',
diff --git a/nodejs/src/ingestion/common/ingestion-warning-types.ts b/nodejs/src/ingestion/common/ingestion-warning-types.ts
index 8d9b2f77c827..fa52a76d8f15 100644
--- a/nodejs/src/ingestion/common/ingestion-warning-types.ts
+++ b/nodejs/src/ingestion/common/ingestion-warning-types.ts
@@ -87,6 +87,9 @@ export const INGESTION_WARNING_TYPES = {
invalid_group_set: { category: 'event', severity: 'error' },
invalid_process_person_profile: { category: 'event', severity: 'warning' },
invalid_event_when_process_person_profile_is_false: { category: 'event', severity: 'error' },
+ // 'info' because the team opted out of person processing, so this drop is the
+ // configured outcome and not a fault in the customer's payload.
+ event_dropped_person_processing_disabled: { category: 'event', severity: 'info' },
event_dropped_too_old: { category: 'event', severity: 'info' },
cookieless_team_disabled: { category: 'event', severity: 'error' },
diff --git a/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.test.ts b/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.test.ts
index e26c4e8e963a..9fb190816820 100644
--- a/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.test.ts
+++ b/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.test.ts
@@ -4,11 +4,14 @@ import { PipelineResultType } from '~/ingestion/framework/results'
import { PluginEvent } from '~/plugin-scaffold'
import { createTestEventHeaders } from '~/tests/helpers/event-headers'
import { createTestPluginEvent } from '~/tests/helpers/plugin-event'
-import { EventHeaders } from '~/types'
+import { createTestTeam } from '~/tests/helpers/team'
+import { EventHeaders, Team } from '~/types'
import { createNormalizeProcessPersonFlagStep } from './normalize-process-person-flag-step'
-type StepInput = { event: PluginEvent; headers: EventHeaders }
+type StepInput = { event: PluginEvent; team: Team; headers: EventHeaders }
+
+const PERSON_ONLY_EVENTS = ['$identify', '$create_alias', '$merge_dangerously', '$groupidentify'] as const
describe('normalizeProcessPersonFlagStep', () => {
const baseEvent: PluginEvent = createTestPluginEvent({
@@ -21,15 +24,35 @@ describe('normalizeProcessPersonFlagStep', () => {
const baseInput: StepInput = {
event: baseEvent,
+ team: createTestTeam({ person_processing_opt_out: false }),
headers: createTestEventHeaders(),
}
const normalizeStep = createNormalizeProcessPersonFlagStep()
describe('$process_person_profile=false', () => {
- it.each(['$identify', '$create_alias', '$merge_dangerously', '$groupidentify'])(
- 'drops event %s when $process_person_profile=false',
- async (eventName) => {
+ it.each(
+ PERSON_ONLY_EVENTS.flatMap((eventName) => [
+ {
+ eventName,
+ optedOut: false,
+ type: 'invalid_event_when_process_person_profile_is_false',
+ reason: 'invalid_event_for_flags',
+ alwaysSend: true,
+ key: undefined,
+ },
+ {
+ eventName,
+ optedOut: true,
+ type: 'event_dropped_person_processing_disabled',
+ reason: 'person_processing_disabled',
+ alwaysSend: false,
+ key: eventName,
+ },
+ ])
+ )(
+ 'drops $eventName as $type when team opt-out is $optedOut',
+ async ({ eventName, optedOut, type, reason, alwaysSend, key }) => {
const input: StepInput = {
...baseInput,
event: {
@@ -37,43 +60,50 @@ describe('normalizeProcessPersonFlagStep', () => {
event: eventName,
properties: { $process_person_profile: false },
},
+ team: createTestTeam({ person_processing_opt_out: optedOut }),
}
const result = await normalizeStep(input)
- expect(result.type).toBe(PipelineResultType.DROP)
+ expect(result).toMatchObject({ type: PipelineResultType.DROP, reason })
expect(result.warnings).toHaveLength(1)
expect(result.warnings[0]).toMatchObject({
- type: 'invalid_event_when_process_person_profile_is_false',
+ type,
details: {
eventUuid: baseEvent.uuid,
event: eventName,
distinctId: 'my_id',
},
- alwaysSend: true,
+ alwaysSend,
})
+ expect(result.warnings[0].key).toBe(key)
}
)
- it('allows regular events when $process_person_profile=false', async () => {
- const input: StepInput = {
- ...baseInput,
- event: {
- ...baseEvent,
- event: '$pageview',
- properties: { $process_person_profile: false },
- },
- }
+ it.each([false, true])(
+ 'allows regular events when $process_person_profile=false and team opt-out is %s',
+ async (optedOut) => {
+ const input: StepInput = {
+ ...baseInput,
+ event: {
+ ...baseEvent,
+ event: '$pageview',
+ properties: { $process_person_profile: false },
+ },
+ team: createTestTeam({ person_processing_opt_out: optedOut }),
+ }
- const result = await normalizeStep(input)
+ const result = await normalizeStep(input)
- expect(result.type).toBe(PipelineResultType.OK)
- if (result.type === PipelineResultType.OK) {
- expect(result.value.processPerson).toBe(false)
- expect(result.value.processPersonExplicitlyTrue).toBe(false)
- expect(result.value.forceDisablePersonProcessing).toBe(false)
+ expect(result.type).toBe(PipelineResultType.OK)
+ expect(result.warnings).toHaveLength(0)
+ if (result.type === PipelineResultType.OK) {
+ expect(result.value.processPerson).toBe(false)
+ expect(result.value.processPersonExplicitlyTrue).toBe(false)
+ expect(result.value.forceDisablePersonProcessing).toBe(false)
+ }
}
- })
+ )
it('adds warning for invalid $process_person_profile values', async () => {
const input: StepInput = {
diff --git a/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.ts b/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.ts
index 3aaaf440ce1c..0d38db8a52c7 100644
--- a/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.ts
+++ b/nodejs/src/ingestion/common/steps/event-processing/normalize-process-person-flag-step.ts
@@ -4,10 +4,13 @@ import { PipelineWarning } from '~/ingestion/framework/pipeline.interface'
import { PipelineResult, drop, ok } from '~/ingestion/framework/results'
import { ProcessingStep } from '~/ingestion/framework/steps'
import { PluginEvent } from '~/plugin-scaffold'
-import { EventHeaders } from '~/types'
+import { EventHeaders, Team } from '~/types'
+
+const PERSON_ONLY_EVENTS = ['$identify', '$create_alias', '$merge_dangerously', '$groupidentify']
type NormalizeProcessPersonFlagInput = {
event: PluginEvent
+ team: Team
headers: EventHeaders
}
@@ -36,14 +39,30 @@ export function createNormalizeProcessPersonFlagStep<TInput extends NormalizePro
const forceDisablePersonProcessing = !decision.processPerson && decision.reason === 'header'
if (!decision.processPerson && decision.reason === 'property') {
- if (['$identify', '$create_alias', '$merge_dangerously', '$groupidentify'].includes(event.event)) {
+ if (PERSON_ONLY_EVENTS.includes(event.event)) {
+ const details = {
+ eventUuid: event.uuid,
+ event: event.event,
+ distinctId: event.distinct_id,
+ }
+
+ // applyPersonProcessingRestrictionsStep stamps $process_person_profile=false
+ // for an opted-out team, so the property alone cannot say who set it.
+ if (input.team.person_processing_opt_out === true) {
+ warnings.push({
+ type: 'event_dropped_person_processing_disabled',
+ details,
+ // The cause is a standing project setting, so debounce per event name.
+ key: event.event,
+ alwaysSend: false,
+ })
+
+ return Promise.resolve(drop('person_processing_disabled', [], warnings))
+ }
+
warnings.push({
type: 'invalid_event_when_process_person_profile_is_false',
- details: {
- eventUuid: event.uuid,
- event: event.event,
- distinctId: event.distinct_id,
- },
+ details,
alwaysSend: true,
})
diff --git a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
index 97b3ff4f1370..634c62e7695e 100644
--- a/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
+++ b/products/ingestion/skills/resolving-ingestion-warnings/SKILL.md
@@ -58,20 +58,21 @@ Those decisions come only from this skill's guidance and your own reasoning.
### Event validation (`event`)
-| Type | What happened | Fix |
-| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `client_ingestion_warning` | The SDK itself reported a problem | Read `details.message` — the SDK wrote the diagnosis at the moment it caught the misuse (e.g. an invalid group key). Never debounced (like `merge_race_condition`), so counts are true counts; group by message and map each back to the misused SDK call |
-| `ignored_invalid_timestamp` | `timestamp` didn't parse; the event was kept with the server time | Read [references/fixing-ignored-invalid-timestamp.md](references/fixing-ignored-invalid-timestamp.md) — send ISO 8601; the event was kept at server time |
-| `schema_validation_failed` | Event dropped: it violates a schema the team enforces for that event | Compare `details.errors` against the payload; align the code or update the schema |
-| `skipping_event_invalid_distinct_id` | Event dropped: distinct ID over 400 chars | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID |
-| `distinct_id_truncated` | Event ingested after its distinct ID was shortened to the 200-char cap (legacy capture endpoints) | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID; `details.distinctIdLength` is the original length, and events land under the shortened ID until the sender is fixed |
-| `invalid_ai_token_property` | An `$ai_*` token property wasn't numeric; it was nulled | Read [references/fixing-invalid-ai-token-property.md](references/fixing-invalid-ai-token-property.md) — token counts must be plain numbers |
-| `invalid_group_set` | `$groupidentify` dropped: `$group_set` wasn't a plain object (a string, number, boolean, or array was sent) | `details.receivedType` names what was sent — `string` usually means the caller JSON-stringified the group properties before passing them; pass a plain object to the SDK's `groupIdentify` call. Omitting `$group_set` is fine (group upserts with no property changes) |
-| `invalid_process_person_profile` | `$process_person_profile` wasn't boolean; the default (true) was used | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — a stringified boolean silently opts back into person processing |
-| `invalid_event_when_process_person_profile_is_false` | `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` dropped because the event disabled person processing | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — identity events require person processing |
-| `event_dropped_too_old` | Intentional: the event is older than the team's configured drop threshold | Read [references/fixing-event-dropped-too-old.md](references/fixing-event-dropped-too-old.md) — mind mobile SDKs: offline queues legitimately deliver days-old events; threshold changes are the user's call |
-| `cookieless_missing_timestamp` / `cookieless_timestamp_out_of_range` / `cookieless_missing_user_agent` / `cookieless_missing_ip` / `cookieless_missing_host` | Cookieless-mode event dropped: a field required to compute the cookieless ID was missing or invalid | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — the missing field identifies the broken layer; beware the silent variant where a server relay omits $ip and users collapse onto the server's IP |
-| `cookieless_team_disabled` | Cookieless-mode event dropped: the SDK sent it in cookieless mode but cookieless tracking is off in the project settings | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — enable Settings → Web analytics → Cookieless tracking, or remove `cookieless_mode` from the SDK config; no code fix needed |
+| Type | What happened | Fix |
+| ------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `client_ingestion_warning` | The SDK itself reported a problem | Read `details.message` — the SDK wrote the diagnosis at the moment it caught the misuse (e.g. an invalid group key). Never debounced (like `merge_race_condition`), so counts are true counts; group by message and map each back to the misused SDK call |
+| `ignored_invalid_timestamp` | `timestamp` didn't parse; the event was kept with the server time | Read [references/fixing-ignored-invalid-timestamp.md](references/fixing-ignored-invalid-timestamp.md) — send ISO 8601; the event was kept at server time |
+| `schema_validation_failed` | Event dropped: it violates a schema the team enforces for that event | Compare `details.errors` against the payload; align the code or update the schema |
+| `skipping_event_invalid_distinct_id` | Event dropped: distinct ID over 400 chars | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID |
+| `distinct_id_truncated` | Event ingested after its distinct ID was shortened to the 200-char cap (legacy capture endpoints) | Read [references/fixing-invalid-distinct-ids.md](references/fixing-invalid-distinct-ids.md) — a token/payload was passed as the distinct ID; `details.distinctIdLength` is the original length, and events land under the shortened ID until the sender is fixed |
+| `invalid_ai_token_property` | An `$ai_*` token property wasn't numeric; it was nulled | Read [references/fixing-invalid-ai-token-property.md](references/fixing-invalid-ai-token-property.md) — token counts must be plain numbers |
+| `invalid_group_set` | `$groupidentify` dropped: `$group_set` wasn't a plain object (a string, number, boolean, or array was sent) | `details.receivedType` names what was sent — `string` usually means the caller JSON-stringified the group properties before passing them; pass a plain object to the SDK's `groupIdentify` call. Omitting `$group_set` is fine (group upserts with no property changes) |
+| `invalid_process_person_profile` | `$process_person_profile` wasn't boolean; the default (true) was used | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — a stringified boolean silently opts back into person processing |
+| `invalid_event_when_process_person_profile_is_false` | `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` dropped because the event disabled person processing | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — identity events require person processing |
+| `event_dropped_person_processing_disabled` | Intentional: person processing is off for the project, so `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` are dropped | Read [references/fixing-process-person-profile-warnings.md](references/fixing-process-person-profile-warnings.md) — no payload fix exists; drop the identity calls or ask staff to re-enable person processing |
+| `event_dropped_too_old` | Intentional: the event is older than the team's configured drop threshold | Read [references/fixing-event-dropped-too-old.md](references/fixing-event-dropped-too-old.md) — mind mobile SDKs: offline queues legitimately deliver days-old events; threshold changes are the user's call |
+| `cookieless_missing_timestamp` / `cookieless_timestamp_out_of_range` / `cookieless_missing_user_agent` / `cookieless_missing_ip` / `cookieless_missing_host` | Cookieless-mode event dropped: a field required to compute the cookieless ID was missing or invalid | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — the missing field identifies the broken layer; beware the silent variant where a server relay omits $ip and users collapse onto the server's IP |
+| `cookieless_team_disabled` | Cookieless-mode event dropped: the SDK sent it in cookieless mode but cookieless tracking is off in the project settings | Read [references/fixing-cookieless-warnings.md](references/fixing-cookieless-warnings.md) — enable Settings → Web analytics → Cookieless tracking, or remove `cookieless_mode` from the SDK config; no code fix needed |
### LLM analytics endpoints (`event`)
diff --git a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-process-person-profile-warnings.md b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-process-person-profile-warnings.md
index e19a01ad8d05..c5916b1485bc 100644
--- a/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-process-person-profile-warnings.md
+++ b/products/ingestion/skills/resolving-ingestion-warnings/references/fixing-process-person-profile-warnings.md
@@ -1,17 +1,20 @@
# Fixing the `$process_person_profile` warnings
-`$process_person_profile: false` marks an event as anonymous — cheaper, no person profile. Two different mistakes around that flag produce two warnings:
+`$process_person_profile: false` marks an event as anonymous — cheaper, no person profile. Three warnings surface around that flag: two are customer mistakes, one is a PostHog-side setting.
| Type | Severity | What happened |
| ---------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `invalid_process_person_profile` | warning | The value wasn't a boolean (`"false"`, `"yes"`, `0`, …) — PostHog **ignored it and defaulted to `true`**. The event was ingested and person processing ran anyway |
| `invalid_event_when_process_person_profile_is_false` | error | An `$identify`/`$create_alias`/`$merge_dangerously`/`$groupidentify` carried a valid `false` — but these operations exist to modify person/group state, so the event was **dropped** |
+| `event_dropped_person_processing_disabled` | info | The same drop, but the customer sent no flag at all: person processing is turned off for the whole project, so PostHog set `false` itself. Their payload is not at fault |
-Both failure modes are silent from the SDK's side. The first quietly opts you back **into** person processing (and its cost); the second makes identity operations no-ops.
+All three are silent from the SDK's side. The first quietly opts you back **into** person processing (and its cost); the other two make identity operations no-ops.
+
+Check the third before diagnosing a payload: if `event_dropped_person_processing_disabled` is the type, no SDK change will bring the events back, because the drop is the configured outcome of the project's person processing opt-out.
## Diagnose
-1. Query the warnings with `posthog:execute-sql`: `SELECT timestamp, details FROM system.ingestion_warnings WHERE type IN ('invalid_process_person_profile', 'invalid_event_when_process_person_profile_is_false') AND timestamp > now() - INTERVAL 7 DAY ORDER BY timestamp DESC LIMIT 20` (narrow to a single `type` to isolate one variant). For the non-boolean variant, the `details` JSON shows the exact value received — its type names the bug (`"false"` = stringified config/env value, `0` = numeric flag). For the dropped variant, the `details` show which identity event was dropped and for which distinct IDs.
+1. Query the warnings with `posthog:execute-sql`: `SELECT timestamp, details FROM system.ingestion_warnings WHERE type IN ('invalid_process_person_profile', 'invalid_event_when_process_person_profile_is_false', 'event_dropped_person_processing_disabled') AND timestamp > now() - INTERVAL 7 DAY ORDER BY timestamp DESC LIMIT 20` (narrow to a single `type` to isolate one variant). For the non-boolean variant, the `details` JSON shows the exact value received — its type names the bug (`"false"` = stringified config/env value, `0` = numeric flag). For the dropped variant, the `details` show which identity event was dropped and for which distinct IDs.
2. Find where the flag gets attached: SDK config, a shared capture wrapper, or the callsite. Env vars and JSON configs are the usual source of stringified booleans; a global "mark everything anonymous" wrapper is the usual source of the identity-event contradiction.
## Fix
@@ -22,7 +25,8 @@ Decide which intent is real, then make the flag match it:
- **You want person profiles for identified users** → in posthog-js use the supported config, `person_profiles: 'identified_only'`, instead of hand-setting the property per event or using `'never'` — identity events then process persons while plain events stay anonymous until identify.
- **A wrapper stamps `false` on everything** → exempt the identity events (`$identify`, `$create_alias`, `$groupidentify`) from it.
- **You truly want no person processing** → stop calling `identify`/`alias`/`group` at all; they cannot work in that mode.
+- **The warning is `event_dropped_person_processing_disabled`** → person processing is off for the project, so there is no payload fix. Either remove the `identify`/`alias`/`group` calls, or ask PostHog support to turn person processing back on. Only a staff member can change that setting.
## Verify
-Re-run the flow, re-query `system.ingestion_warnings` with `posthog:execute-sql` (filter `type IN ('invalid_process_person_profile', 'invalid_event_when_process_person_profile_is_false')`, `timestamp` after your fix) — no new occurrences of either type — and confirm the intended behavior: anonymous events stop creating person profiles, and persons/groups update again where they should.
+Re-run the flow, re-query `system.ingestion_warnings` with `posthog:execute-sql` (filter `type IN ('invalid_process_person_profile', 'invalid_event_when_process_person_profile_is_false', 'event_dropped_person_processing_disabled')`, `timestamp` after your fix) — no new occurrences of either type — and confirm the intended behavior: anonymous events stop creating person profiles, and persons/groups update again where they should.
diff --git a/rust/common/ingestion_warnings/warning_types.generated.json b/rust/common/ingestion_warnings/warning_types.generated.json
index 7abc015a90c5..088e7416e310 100644
--- a/rust/common/ingestion_warnings/warning_types.generated.json
+++ b/rust/common/ingestion_warnings/warning_types.generated.json
@@ -91,6 +91,12 @@
"severity": "info",
"captureProduced": false
},
+ {
+ "type": "event_dropped_person_processing_disabled",
+ "category": "event",
+ "severity": "info",
+ "captureProduced": false
+ },
{
"type": "event_dropped_too_old",
"category": "event",