JSON Parsing Error in /agents Feature When Creating Custom Agent

Open 💬 35 comments Opened Jul 25, 2025 by mjstelly

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:

  1. Use /agents command to create new agent
  2. Paste any text into the agent description field (even simple text like "You are a helpful assistant")
  3. 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"}]

View original on GitHub ↗

35 Comments

ppalladino · 11 months ago

I am getting the same error

nexium0 · 11 months ago

I'm encountering the same error with the Claude Code CLI when attempting to generate the agent using Option 1: 'Generate with Claude (recommended)

advdrone · 11 months ago

I'm getting an error "No JSON object found in response" when I do this

aoki-h-jp · 11 months ago

same error occured when Claude Code hit limit rate (usage limit)

ruflin · 11 months ago

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
azdolinski · 11 months ago

I have the same problem.

travis-jorge · 11 months ago

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?

mjstelly · 11 months ago

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.

session-manager.md

jame-earnin · 11 months ago

same issue

Adam-Langevin · 11 months ago

I have the same issue

avnersender · 11 months ago

I got this error when my balance at anthropic was 0$, adding a few bucks seems to have solved the json error.

18h32n · 11 months ago

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.

bourne-3 · 11 months ago

same issue(not only English but also Chinese)

ceckenrode · 11 months ago

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.

<img width="786" height="156" alt="Image" src="https://github.com/user-attachments/assets/ce9ec59e-f303-46ed-8188-30aa43d34773" />

Update: I fixed it, heres how

Background: I'm using NVM to manage node installs on my machine.

  1. I used nvm to install node v22.18.0 and and switched to using that (my previous version was v22.18.0)
  2. I then had to reinstall claude code because my new node installation didn't have it.
  3. 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.

joaovictorjoao · 11 months ago

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.

Skyryo · 11 months ago

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.

<img width="828" height="278" alt="Image" src="https://github.com/user-attachments/assets/652516e1-fb72-4ff2-b4f1-9514aaea7308" />

testkun08080 · 11 months ago

https://github.com/anthropics/claude-code/issues/4351#issuecomment-3170208980
@Skyryo
I was facing the same problem, and thanks — this worked for me!

aifirstd3v · 10 months ago

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.

lnedry · 9 months ago

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.

limoragni · 9 months ago

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.

showonlady · 8 months ago

Hit same issue

zackarno · 7 months ago

Same issue here

trinanda · 7 months ago

same issue here

<img width="768" height="400" alt="Image" src="https://github.com/user-attachments/assets/b3f0e333-83b8-40de-af0f-2ca4fc8aec8a" />

github-actions[bot] · 6 months ago

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.

GanizaniSitara · 6 months ago

No longer an issue for me as of today. The creation now works.

tkm5 · 6 months ago

I am still having the problem of getting the message "No JSON object found in response".

sankhlaofficial · 6 months ago

Issue still persists

nikoethonai · 6 months ago

The issue goes away if I change from Sonnet to Opus....

welsewool · 5 months ago

same issue

nixit28 · 5 months ago

same issuue

xuxvming · 4 months ago

same issue, any updates on this?

dewey · 4 months ago
nqdai1992 · 4 months ago

I have same issue. Any update for this ticket?

osuritz · 4 months ago

+1 and setting the model to Opus doesn't fix it for me

Claude Code v2.1.62
Opus 4.6 · Claude Pro
AlexanderStout · 3 months ago

I had "No JSON object found in response" issue and In my case the problem was that my session expired. Running /login solved it for me