fix(cli): CliUserError for app add when app ID is taken - #3300
fix(cli): CliUserError for app add when app ID is taken#3300posthog-eu[bot] wants to merge 1 commit into
Conversation
The three "Could not add app" exits in addAppInternal threw a plain Error, so error tracking captured them as unhandled crashes. An app ID taken by another organization is a normal user state — the CLI prints a clear message and exits non-zero. Throw CliUserError instead so shouldCapturePosthogException filters it by type, matching how bundle upload handles "Version X already exists". Generated-By: PostHog Desktop Task-Id: 04404da2-540e-439a-8087-b57153a51d63
Merging this PR will not alter performance
Comparing Footnotes
|
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Coding is complete on HEAD |
AI review: APPROVEDReviewed Diff check
Rationale: Expected user outcomes (app ID already taken / ownership conflict) should not open PostHog error-tracking issues. This matches existing CLI patterns ( Note: Could not submit a formal GitHub APPROVE review from this agent token ( |
TorichanCapgo
left a comment
There was a problem hiding this comment.
LGTM — 3× Error→CliUserError in addAppInternal + test; matches existing PostHog skip-by-type pattern. AI review clear; CR skips bot author.



Summary
app addstill files false error-tracking issues on the newest release. When an app ID is registered to another organization — a normal user situation — the CLI prints a clear message and exits non-zero, but the throw was a plainError, soshouldCapturePosthogExceptioncaptured it as an unhandled crash.Could not add app …exits inaddAppInternalnow throwCliUserError.shouldCapturePosthogExceptionskipsCliUserErrorby type, so these expected states no longer open a$exceptionissue. Non-zero exit, printed message, and failure analytics are unchanged.bundle upload(Version X already exists), applied to the last branch in the%already exists%family still filing issues.cli/src/app/add.ts)throw new Errorthrow new CliUserErrorthrow new Errorthrow new CliUserErrorthrow new Errorthrow new CliUserErrorTest plan
bun run test:posthog-exception— extended to assert theapp addtaken-ID message is filtered by type.bun run test:app-add-existsbun run lintbun run typecheckScreenshots
Checklist
bun run lint.Agent context
checkAlertsincli/src/api/update.tshas ~15 callers (includingadd.ts:297), so the "no caller" claim is stale; and the shared-fingerprint concern is inherent to the error-tracking design and out of scope for this symptom.Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.