Skip to content

fix(mcp): classify Claude Code plugin install errors as soft failures#468

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/claude-code-plugin-soft-fail
Draft

fix(mcp): classify Claude Code plugin install errors as soft failures#468
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/claude-code-plugin-soft-fail

Conversation

@posthog
Copy link
Copy Markdown

@posthog posthog Bot commented May 21, 2026

Problem

installPlugin() in src/steps/add-mcp-server-to-clients/clients/claude-code.ts shells out to claude plugin install posthog and only special-cases already installed / already exists. Every other failure — including problems entirely on the user's machine — was routed through analytics.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.json over ~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 the plugin subcommand at all.

Changes

Classify stderr from claude plugin install posthog before calling analytics.captureException:

  • Known user-environment signatures (malformed settings.json, missing marketplace, outdated CLI) → return { success: false }, log a clear, actionable warning via getUI().log.warn, and write the raw stderr to the wizard log file for support. No captureException.
  • Anything else → behave as before and capture the exception, so genuinely unexpected failures stay visible.

The classifier lives next to the client so adding new known-bad signatures is one line of regex + copy. installPlugin keeps 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 asserting captureException is 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

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
@github-actions
Copy link
Copy Markdown

🧙 Wizard CI

Run 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:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

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