fix(cli): stop error-tracking expected user errors and per-version fingerprints - #2885
Merged
riderx merged 2 commits intoAug 7, 2026
Merged
Conversation
…ngerprints - Drop the CLI version from the exception fingerprint so one error is one issue across releases (version still reported via cli_version). - Skip exception capture for expected user errors (401 invalid_apikey / no_key_provided, app-not-found) while still counting them via trackCommandFailed. - Log the underlying PostgREST cause in getOrganizationId instead of discarding it. - Verify app existence + upload permission before the org lookup in bundle upload so users get an actionable message instead of the opaque org-id throw. Generated-By: PostHog Code Task-Id: cca2ec80-cecd-4b4a-8f45-e50058b4206f
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
5 tasks
Co-authored-by: Cursor <cursoragent@cursor.com>
riderx
marked this pull request as ready for review
August 7, 2026 16:23
riderx
deleted the
posthog-self-driving/fixcli-stop-reporting-expected-user-1ec900
branch
August 7, 2026 16:24
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Ordinary user mistakes from the CLI (bad/missing API key, app not created yet) were being reported to error tracking and re-fingerprinted on every release, so the same errors kept spawning brand-new issues instead of one triageable issue.
Why: real signal was shredded into noise — the
bundle uploadorg-lookup failure alone fired ~1.4K times over 90 days, split across 40+ per-version fingerprints, and every CLI release triggered a fresh round of "new issue" alerts for problems that have existed for months. Users hit the same path got an opaque message with no hint about what to do.Two root causes, both in the CLI:
capturePosthogExceptionfoldedcli:<version>:<command>into$exception_fingerprint, so every release re-fingerprinted identical errors into a fresh issue.Plus,
getOrganizationIddiscarded itsformatError(error)result (losing the real PostgREST cause), andbundle uploadran the org lookup before the app-existence/permission check — so a missing app failed withCannot get organization idinstead of the actionable "runapp add" message.Changes
posthog.tsfingerprintcli:<command>:…); version still sent ascli_versionindex.tstop-level handlerinvalid_apikey/no_key_provided, app-not-found); still callstrackCommandFailedgetOrganizationIdformatError(error)result discardedbundle uploadorderExpected user errors are identified by a new
isExpectedUserErrorhelper (message markers + 401 status, including supabase-jsFunctionsHttpError.context.status). Genuinely unexpected failures — including a realgetOrganizationIdthrow for an app that does exist — are still captured.Test plan
bun test/test-posthog-exception.mjs— extended to assert the fingerprint no longer contains the version and thatisExpectedUserErrorclassifies the invalid-key / no-key / app-not-found / 401 cases as expected and other errors as not.bun run lintandbun run typecheckpass.Screenshots
N/A — telemetry/error-classification change, no visible CLI output change beyond the org-lookup error now including its cause.
Checklist
bun run lint.Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.