Skip to content

fix(mcp): don't capture external Claude/Codex config errors as wizard exceptions#456

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/skip-capture-external-mcp-config-errors
Draft

fix(mcp): don't capture external Claude/Codex config errors as wizard exceptions#456
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/skip-capture-external-mcp-config-errors

Conversation

@posthog
Copy link
Copy Markdown

@posthog posthog Bot commented May 18, 2026

Summary

Nine distinct users tripped the same error tracking signal over ~12 days: Claude Code plugin install failed: Invalid schema: plugins.N.source: Invalid input. The root cause is outside the wizard's scope — the user's pre-existing ~/.claude plugins config has invalid source fields on unrelated plugin entries, so claude plugin install posthog is rejected before it ever touches PostHog. The wizard then captureException'd the failure as if it were a bug we should fix.

This change adds a small detector (isExternalClientConfigError) for that error shape and guards the four affected paths so they fail quietly via debug() instead of polluting error tracking:

  • ClaudeCodeMCPClient.installPlugin
  • ClaudeCodeMCPClient.removeServer
  • CodexMCPClient.installPlugin
  • CodexMCPClient.removeServer (also switched from stdio: 'ignore' to capturing stderr, so the guard applies symmetrically)

Genuine failures (timeouts, missing binaries, real wizard bugs) still capture as before. The wizard already degrades gracefully when an installPlugin returns { success: false } — the affected client simply doesn't appear in the McpScreen "installed for" list, so no UI plumbing was needed.

Test plan

  • pnpm build — passes
  • pnpm test — 619/619 passing (one unrelated flaky test in provision-cli that times out under full-suite load and passes in isolation; verified the flake is pre-existing by re-running with my changes stashed)
  • pnpm lint — 0 errors (pre-existing warnings only)
  • New tests cover: schema-error install (claude), schema-error remove (claude), schema-error install (codex), schema-error remove (codex), and the helper itself

Created with PostHog Code

The wizard shelled out to `claude plugin install posthog` and treated any
non-zero exit as a wizard exception. When a user's pre-existing ~/.claude
plugins config has invalid `source` entries, Claude rejects the whole
command up front with `Invalid schema: plugins.N.source: Invalid input` —
nine distinct users tripped this in ~12 days, each one polluting error
tracking with a non-actionable signal.

Add an `isExternalClientConfigError` helper that matches the schema
rejection pattern, and guard the Claude/Codex install + remove paths so
those errors return `{ success: false }` quietly via `debug()` instead of
firing `analytics.captureException`. Genuine failures (timeouts, missing
binaries, etc.) still capture as before.

Also switches Codex `removeServer` from `stdio: 'ignore'` to capturing
stderr, so the same guard applies symmetrically.

Generated-By: PostHog Code
Task-Id: 514b43e3-f2f5-464e-bc69-eeaa48ae0061
@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