Skip to content

fix(cli): stop error tracking for missing bundle versions - #2973

Draft
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixcli-stop-error-reporting-missing-bae501
Draft

fix(cli): stop error tracking for missing bundle versions#2973
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixcli-stop-error-reporting-missing-bae501

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A missing bundle version is a user typo or a version that was never uploaded, not a CLI crash — but the team pays for it in triage, because every failure opens a fresh error tracking issue.
  • getVersionData in cli/src/api/versions.ts threw a plain Error when the named bundle was not in the active list. isExpectedUserError only knew about bad API keys and not-yet-created apps, so this failure reached error tracking as an unhandled crash.
  • The message interpolated the app id and the version, so each distinct version string got its own fingerprint — one problem split into dozens of single-event issues.
  • This is the shared chokepoint for channel set, bundle delete, and bundle cleanup.

Fix — the same pattern PR #2885 and PR #2934 applied to auth failures and upload aborts:

Before After
throw new Error(\App version ${appid}@${bundle} doesn't exist`)` throw new CliUserError('App version doesn\'t exist', { appId, version })
  • CliUserError is skipped by shouldCapturePosthogException via instanceof, so error tracking no longer opens an issue.
  • The non-zero exit, the printed message, and the trackCommandFailed analytics stay unchanged.
  • The app id and version move into the CliUserError context object, so the message is now constant and one problem stays one issue.
  • The two sibling throws in deleteAppVersion get the same treatment.

Test plan

  • cd cli && bun run lint — passes clean on the changed file.
  • Manual: run capgo channel set <channel> --bundle <version> with a version that was never uploaded. The CLI still prints App version <app>@<version> doesn't exist and exits non-zero, but no error tracking $exception issue is opened.

Screenshots

Checklist

  • My code follows the code style of this project and passes
    bun run lint:backend && bun run lint.
  • My change requires a change to the documentation.
  • I have updated the documentation
    accordingly.
  • My change has adequate E2E test coverage.
  • I have tested my code manually, and I have provided steps how to reproduce
    my tests

Created with PostHog Desktop from this inbox report.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Throw CliUserError instead of a plain Error when a named bundle version is
not found, so error tracking skips it. Move the app id and version out of the
message and into the CliUserError context, so one problem stays one issue
instead of one per version string.

Covers `getVersionData` (used by channel set, bundle delete, bundle cleanup)
and both throws in `deleteAppVersion`.

Generated-By: PostHog Code
Task-Id: 6571dd73-5da0-4970-a26a-9bc5bef6449a
@codspeed-hq

codspeed-hq Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing posthog-self-driving/fixcli-stop-error-reporting-missing-bae501 (fa5a7d0) with main (e745fdd)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants