Skip to content

fix(mcp): show a hint for invalid Claude Code settings JSON on plugin install - #1366

Merged
gewenyu99 merged 3 commits into
mainfrom
posthog-self-driving/fixmcp-show-a-hint-for-local-claude-e0e54e
Oct 7, 2026
Merged

gewenyu99 merged 3 commits into
mainfrom
posthog-self-driving/fixmcp-show-a-hint-for-local-claude-e0e54e

Conversation

@posthog

@posthog posthog Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

  • A user with invalid JSON in ~/.claude/settings.json cannot install the PostHog Claude Code plugin. They see the raw CLI error and get no clear next step.
  • The wizard cannot fix that file, but it still reports each failure as an exception.
  • installPlugin puts the raw CLI output into the exception message. Each new wording becomes a new error tracking issue, so one failure class splits across many issues.

Origin

  • Error tracking: issue 1, issue 2
  • First signal: 2026-09-26
  • Inbox report: open
  • Likely cause: 8c54c11
  • Task started by: auto-start, after the report was rated P3 and ready to fix

Changes

  • Add an EXPECTED_FAILURES table to claude-code.ts, scoped to the plugin install stage. It uses the same expectedFailureHint path as codex.ts.
  • The first entry matches Invalid JSON syntax in settings file at ~/.claude/settings.json. The user sees: fix the invalid JSON in ~/.claude/settings.json, then retry. The wizard sends mcp expected failure hinted and no exception.
  • Failures that are still reported use the constant message Claude Code plugin install failed. The scrubbed CLI output goes in the details property, next to stage and marketplaceFailure.
Failure Before After
Invalid user settings JSON exception, raw CLI text hint + mcp expected failure hinted event
Invalid project settings JSON exception, raw CLI text exception, constant message (still reported)
Other install failures exception, message changes with CLI text exception, constant message, text in details

Note

The match is only for the user-level file. A project .claude/settings*.json path is not one the hint can name, so it stays reported.

Test plan

  • npx vitest run src/steps/add-mcp-server-to-clients: 183 tests pass.
  • New tests: the invalid user settings JSON gives the hint, sends the event, and does not report an exception. A project settings file still reports.
  • The existing tests now check the constant message and the details / marketplaceFailure properties.

LLM context

  • The match wording comes from the matching error tracking issue.
  • Older drafts #468 and #456 came before the rewrite in #1294. This change is new, on top of the current code.
  • Scope is only the plugin install stage. mcp add, mcp remove, and plugin uninstall still put the raw text in the message.

Created with PostHog Desktop from this inbox report.

🤖 Generated with Claude Code

… install

Add an expected-failure table to the Claude Code client for the plugin install stage. Invalid JSON in ~/.claude/settings.json now returns a hint and sends `mcp expected failure hinted`. Other plugin install failures use a constant exception message and put the scrubbed detail in a property.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Generated-By: PostHog Desktop
Task-Id: 04a7c3a8-17e9-4e2b-8031-ec7776c32a3c
@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 ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci feature-flags
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /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 feature-flags/django
  • /wizard-ci feature-flags/next-js
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥸 Reviewed by NotVincent, totally not Vincent. The real Vincent will review it separately. Probably slop, please disregard.

Comment thread src/steps/add-mcp-server-to-clients/clients/claude-code.ts Outdated
Comment thread src/shared/mcp-clients/clients/claude-code.ts
Comment thread src/steps/add-mcp-server-to-clients/clients/__tests__/claude-code.test.ts Outdated
@gewenyu99
gewenyu99 marked this pull request as ready for review October 7, 2026 14:04
@gewenyu99
gewenyu99 requested a review from a team as a code owner October 7, 2026 14:04
@gewenyu99
gewenyu99 merged commit 72d0500 into main Oct 7, 2026
19 checks passed
@gewenyu99
gewenyu99 deleted the posthog-self-driving/fixmcp-show-a-hint-for-local-claude-e0e54e branch October 7, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant