JSON Parsing Error in /agents Feature When Creating Custom Agent
Bug Description The new /agents feature is throwing JSON parsing errors when trying to create a custom agent, even with clean text input.
Error message: "Bad control character in string literal in JSON at position [X] (line 3 column [Y])"
Steps to reproduce:
- Use /agents command to create new agent
- Paste any text into the agent description field (even simple text like "You are a helpful assistant")
- Error occurs consistently at various character positions
Expected behavior: Should accept clean text input without JSON parsing errors
Actual behavior: Fails with JSON control character error
Additional context: Error persists even with:
- Single line text with no special characters
- Very short prompts (under 50 characters)
- Text typed directly vs copy-pasted
- Different browsers/devices
This suggests the issue is in how the system processes the input text, not the content itself.
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.60
- Feedback ID: ca2267f4-d9a7-49a3-b8db-2e03400bc461
Errors
[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:892:11)\n at execSync (node:child_process:964:15)\n at i7 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:865:5196)\n at file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:49014\n at Q (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:674:14420)\n at kJ (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:46725)\n at XH (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:45592)\n at I9 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:51640)","timestamp":"2025-07-25T01:46:01.726Z"},{"error":"Error: Command failed: security delete-generic-password -a $USER -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:892:11)\n at execSync (node:child_process:964:15)\n at i7 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:865:5196)\n at FaA (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:50130)\n at GaA (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:50002)\n at C$0 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1902:2567)\n at fZ1.startOAuthFlow (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1902:3766)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-07-25T01:46:10.487Z"},{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:892:11)\n at execSync (node:child_process:964:15)\n at i7 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:865:5196)\n at file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:49014\n at Q (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:674:14420)\n at kJ (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:46725)\n at XH (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:45592)\n at I9 (file:///Users/mjstelly/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:777:51640)","timestamp":"2025-07-25T01:46:10.555Z"}]
I am getting the same error
I'm encountering the same error with the Claude Code CLI when attempting to generate the agent using Option 1: 'Generate with Claude (recommended)
I'm getting an error "No JSON object found in response" when I do this
same error occured when Claude Code hit limit rate (usage limit)
If I use Option 1 "Generate with Claude" it fails as described above. If I use Option 2 "Manual configuration", it works.
│ ❯ 1. Generate with Claude (recommended)
│ 2. Manual configuration
I have the same problem.
Same issue here. │ Bad control character in string literal in JSON at position 1782 (line 4 │ │ column 335)
is there any update or workaround for this problem?
Someone on claude subreddit posted a workable solution. Rather than choose the option for claude to auto-generate, tell claude -- before running /agents -- to output the agents content/structure, then during manual creation when prompted to input the instructions, copy/paste it into the text area. I've attached an example that claude helped me build. Feel free to use it if you like.
same issue
I have the same issue
I got this error when my balance at anthropic was 0$, adding a few bucks seems to have solved the json error.
Same issue (No JSON object found in response). For context, I am on Pro plan, I did not hit my limit, I used option 1 (generate with claude), this is the first time I try to create an agent.
What I did was that I went back to my project files, I created new folder named .claude and create another new folder inside .claude named agents. It worked for me.
same issue(not only English but also Chinese)
Same issue. Tried rolling back to a previous version, also tried what @18h32n did to resolve, did not work for me. The description I give it doesn't seem to change anything. On MacOS 15.2, apple M2 chip.
Update: I fixed it, heres how
Background: I'm using NVM to manage node installs on my machine.
- I used nvm to install node v22.18.0 and and switched to using that (my previous version was v22.18.0)
- I then had to reinstall claude code because my new node installation didn't have it.
- After reauthenticating with claude code, I tried creating subagents again, and it worked this time.
So it seems like there's either something going on where claude code needs to be completely uninstalled and reinstalled, or there's some issue that's in the node environment (idk maybe some file claude stores somewhere thats in the node env) that doesn't allow for this to work.
I was having the "No JSON object found in response" isse and asked to Claude Code how to create an agent and it gave me the following answer: "Claude Opus is not available with the Claude Pro plan. If you have updated your subscription plan recently, run /logout and /login for the plan to take effect.". So I've logged out and logged in and now it works.
Problem: Pro plan users may encounter Opus model execution failures and JSON generation errors when using default settings.
Solution: Use the /model command to verify your current plan, then select Sonnet model if needed to resolve compatibility issues.
https://github.com/anthropics/claude-code/issues/4351#issuecomment-3170208980 @Skyryo I was facing the same problem, and thanks — this worked for me!
Although trying things like logging in and out or changing the /model setting may help, in my case I’ve found that this error mainly occurs when the limit is nearly reached or already exceeded. Usually, you just have to wait until it resets.
Claude Code Pro plan using sonnet. I'm getting this error at the start of my work day so I know it is not related to token limits. It only seems to happen when I use the option for Claude to auto-generate a subagent. It always happens when I paste text and only sometimes when I enter the text by typing.
Same issue here. Creating an agent for the first time, but in my case I was not logged in to my recently created pro account. So a message saying you don't have balance or account type for this operation would be much less confusing than what you get now.
Hit same issue
Same issue here
same issue here
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
No longer an issue for me as of today. The creation now works.
I am still having the problem of getting the message "No JSON object found in response".
Issue still persists
The issue goes away if I change from Sonnet to Opus....