fix(mcp): classify Claude Code plugin install errors as soft failures#468
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(mcp): classify Claude Code plugin install errors as soft failures#468posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Known user-environment failures from `claude plugin install posthog` (malformed ~/.claude/settings.json, missing PostHog marketplace, or a too-old Claude Code CLI) are now surfaced to the user via a warning log instead of being captured as wizard exceptions. Only genuinely unexpected failures still go to error tracking. This stops the install-flow path from dominating wizard error tracking with noise the wizard cannot fix — the four "Invalid JSON syntax in settings file" reports surfaced over the last two weeks all came through this single captureException call. Generated-By: PostHog Code Task-Id: 5280ec8e-0964-45e5-8981-aa8b53a3fd5a
🧙 Wizard CIRun the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands: Test all apps:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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.
Problem
installPlugin()insrc/steps/add-mcp-server-to-clients/clients/claude-code.tsshells out toclaude plugin install posthogand only special-casesalready installed/already exists. Every other failure — including problems entirely on the user's machine — was routed throughanalytics.captureException, polluting wizard error tracking with noise the wizard cannot fix.The recurring example: four distinct users across Linux and macOS hit
Invalid JSON syntax in settings file at <home>/.claude/settings.jsonover ~13 days. The root cause is the user's own malformed~/.claude/settings.json, but each occurrence fired as an unhandled wizard exception. The same pattern was happening for "Plugin posthog not found in any configured marketplace" and for too-old Claude Code binaries that don't yet support thepluginsubcommand at all.Changes
Classify stderr from
claude plugin install posthogbefore callinganalytics.captureException:settings.json, missing marketplace, outdated CLI) → return{ success: false }, log a clear, actionable warning viagetUI().log.warn, and write the raw stderr to the wizard log file for support. NocaptureException.The classifier lives next to the client so adding new known-bad signatures is one line of regex + copy.
installPluginkeeps its existing{ success, alreadyInstalled? }contract — no caller changes.Test plan
pnpm jest src/steps/add-mcp-server-to-clients/clients/__tests__/claude-code.test.ts— 13/13 pass, including three new cases covering the soft-failure paths and one regression case assertingcaptureExceptionis still called for unexpected errors.pnpm build— clean.pnpm lint— 0 errors (warning count unchanged from main).LLM context
Authored by PostHog Code in response to a recurring P3 signal that surfaced four distinct users hitting the same install-flow failure inside the broader `Claude Code plugin install failed` class (~615 events / 267 users in 90 days).
Created with PostHog Code