fix(cli): stop error-tracking noise from duplicate-version uploads - #2934
Merged
riderx merged 2 commits intoAug 8, 2026
Merged
Conversation
Duplicate-version uploads (`Version X already exists`) and other deliberate upload aborts still opened `$exception` issues, because `uploadFail` threw a bare `Error` that the message-substring filter never matched. - `uploadFail`, the upload path's single failure chokepoint, now throws `CliUserError`, so `shouldCapturePosthogException` filters the whole path by type instead of by message. Same treatment for the plan-upgrade checks and `app add`. Non-zero exit and analytics events are unchanged. - Drop the top-frame symbol and filename from the exception fingerprint. The CLI ships as one minified `dist/index.js`, so the symbol is renamed each release and the filename is the full install path — which splits one bug into a fresh issue per npx/bunx/pnpm/sandbox location and per release. - Fix the graceful-exit warning to name the real flag `--version-exists-ok` instead of the non-existent `--silent-fail`. Generated-By: PostHog Code Task-Id: e2d8341d-2959-4d2c-852c-7173ea0705a7
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
This was referenced Aug 8, 2026
riderx
marked this pull request as ready for review
August 8, 2026 17:14
riderx
enabled auto-merge (squash)
August 8, 2026 17:19
Keep uploadCancel() from main (warn + CliUserError) and retain both PostHog exception filter tests for duplicate-version and cancel paths. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
riderx
deleted the
posthog-self-driving/fixcli-stop-error-tracking-version-x-3f6676
branch
August 8, 2026 17:22
cursor Bot
pushed a commit
that referenced
this pull request
Aug 8, 2026
Keep main's install-path fingerprint comments and both CliUserError skip assertions (not-logged-in from this PR, duplicate-version from #2934). Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
2 tasks
|
posthog-eu Bot
added a commit
that referenced
this pull request
Aug 9, 2026
A transient database failure in `getUserIdFromApikey` returned null, which the files service reported as `400 user_not_found`. The CLI showed users a bad-key message and opened an error-tracking issue for each failure. Backend: - `getUserIdFromApikey` now rethrows a query failure instead of returning null, so a backend blip surfaces as a 500, not a missing user. - `checkWriteAppAccess` returns `401 user_not_found` (was 400), matching how `invalid_apikey` behaves on the same route. CLI: - Add a shared `buildTusUploadError` helper that turns a tus failure into a real Error carrying the HTTP status, backend message, and request id. `uploadTUS` and the delta path (`partial.ts`) both use it, so the delta path no longer rejects the raw tus blob that leaked the URL and per-file object key. - The attached `.status` and the new `user_not_found` marker let `isExpectedUserError` classify the auth failure and skip error tracking. Merging this fix cuts a CLI release that also carries the earlier fixes (#2885, #2933, #2934, #2947) that no released build contains yet. Generated-By: PostHog Code Task-Id: c66eba6b-af49-4627-84ac-2c007ed83bc0
This was referenced Aug 9, 2026
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
bundle upload— a normal outcome the user fixes by bumping the version — still minted an error-tracking$exceptionissue on every run, crowding out real CLI crashes.CliUserError+ a type filter inshouldCapturePosthogException, butVersion X already existswas never wired into it:uploadFailthrew a bareError, which the message-substring filter never matched.Two small changes:
uploadFailthrows bareError→ capturedCliUserError→ filtered by typeapp addError→ capturedCliUserError→ filteredfn:kind:name:symbol:filename:statusfn:kind:name:status--silent-fail(does not exist)--version-exists-okBehaviour kept intact: non-zero exit, the printed message, and the
trackCommandFailedanalytics events. Only the$exceptioncapture goes away.Why drop the frame instead of normalizing it: the CLI ships as one minified
dist/index.js, so the top-frame symbol is renamed on every release and every frame's filename is the same install-path-prefixedindex.js. Neither carries stable, discriminating signal — the command path, error kind, error name, and exit status do.Test plan
bun test/test-posthog-exception.mjs— added cases:CliUserError('Version X already exists')andUpload cancelled by userare not captured; fingerprint no longer contains the symbol or filename.bun test/test-init-app-conflict.mjs—isAppAlreadyExistsErrorstill matches the rewordedapp adderror (id moved tocontext,"already exists"kept in the message).bun test/test-plan-validation.mjs,bun test/test-trial-warning.mjs,bun test/test-analytics-error-category.mjs,bun test/test-app-created-source.mjs— all pass.tsgo --noEmitandoxlintclean.Screenshots
Not applicable — no visible CLI output changes except the corrected
--version-exists-okflag name in one warning line.Checklist
bun run lint:backend && 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.