Feature Request: Enhance `/doctor` to show specific JSON parsing errors in settings files
Title: Feature Request: Enhance /doctor to show specific JSON parsing errors in settings files
Is your feature request related to a problem? Please describe.
Currently, when a settings.json file is malformed (e.g., contains a syntax error like a missing comma), the /doctor command provides a generic error message.
Invalid Settings
/Users/user/.claude/settings.json
└ Invalid or malformed JSON
While it's helpful that /doctor identifies the problematic file, the "Invalid or malformed JSON" message isn't specific enough to help the user quickly locate and fix the error. The user has to manually inspect the entire file or paste it into an external validator to find the syntax issue, which can be time-consuming, especially for larger configuration files.
Describe the solution you'd like
I propose enhancing the /doctor command to include more specific details about the JSON parsing error. When an invalid settings.json file is detected, the output should not only identify the file but also provide context about the error itself.
Ideally, this would include:
- The line and column number where the syntax error occurs.
- A brief, high-level description of the error (e.g., "Unexpected token", "Missing comma").
This would make the /doctor command a much more powerful and useful diagnostic tool for configuration issues.
Describe alternatives you've considered
The current alternative is to copy the contents of the settings file and paste it into an online JSON validator or an IDE, which is an extra, inconvenient step. Integrating this basic validation feedback directly into /doctor would create a much smoother user experience.
Example of Desired Behavior
Here is a mock-up of how the improved output could look:
Invalid Settings
/Users/user/.claude/settings.json
└ Invalid or malformed JSON: Unexpected token "}" at line 42, column 5
Or, for a different type of error:
Invalid Settings
/Users/user/.claude/settings.json
└ Invalid or malformed JSON: Missing comma after key-value pair at line 18, column 12
Additional context
This feature would align with the "doctor" metaphor by not just diagnosing a problem ("you have a broken file") but also providing a more precise location of the issue ("the break is here"), empowering users to fix their own configuration problems quickly and efficiently.
Thank you for considering this enhancement
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗