[BUG] v2.1.154 regression: custom agents via `/agents` fail with "messages[1].role: unknown variant `system`"

Resolved 💬 3 comments Opened May 29, 2026 by hkrds1996 Closed Jul 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After auto-updating from v2.1.153 to v2.1.154, invoking a custom agent via /agents immediately fails with an API 400 error. The same agent works perfectly on v2.1.153. Rolling back to 2.1.153 resolves the issue.

What Should Happen?

should no error

Error Messages/Logs

API Error: 400 Failed to deserialize the JSON body into the target type: messages[1].role: unknown variant `system`, expected `user` or `assistant` at line 1 column 16679

Steps to Reproduce

  1. Have a custom agent defined in .claude/agents/ (mine is ~24KB with memory instructions)
  2. Update to v2.1.154 (or let auto-update apply it)
  3. Start a new session: claude
  4. Run /agents and select the custom agent
  5. Send any message

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.154

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Works on: v2.1.153
  • Broken on: v2.1.154
  • Fresh session: Yes — I deleted all conversation history (.jsonl files) and the error still occurs on a brand new conversation with zero history
  • Column position is consistent: Always around column 16679, which corresponds to the size of my CLAUDE.md (~15KB) — suggesting the agent system prompt is being placed as a role: "system" message inside the messages array instead of the top-level system parameter
  • Workaround: npm install -g @anthropic-ai/claude-code@2.1.153
  • #60947 — same error message but triggered by long/compacted sessions. This issue is a v2.1.154 regression that hits on fresh sessions with custom agents.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗