Bug: Trailing quote in subagent_type parsing from pseudo-code blocks

Resolved 💬 3 comments Opened Jan 23, 2026 by simfor99 Closed Feb 28, 2026

Summary

When Claude Code interprets Task() pseudo-code blocks in slash command markdown files, the subagent_type parameter value incorrectly includes a trailing quote character, causing agent spawning to fail.

Environment

  • Claude Code Version: 2.1.15
  • Platform: Linux (WSL2)
  • OS Version: 6.6.87.2-microsoft-standard-WSL2

Reproduction Steps

  1. Create a slash command markdown file with a Task() instruction block:
## Spawn Agent

Task(
  prompt="Your instructions here",
  subagent_type="general-purpose",
  model="sonnet",
  description="Research Phase 2.5"
)
  1. Execute the slash command that triggers this Task() block
  1. Observe the error output

Expected Behavior

Claude Code should parse subagent_type="general-purpose" and extract the value general-purpose (without quotes).

The agent should spawn successfully with type general-purpose.

Actual Behavior

Claude Code extracts the value as general-purpose" (with trailing quote).

Error message:

● general-purpose"(Research Phase 2.5)
  ⎿  Error: Agent type 'general-purpose"' not found. Available agents: Bash,
     general-purpose, statusline-setup, Explore, Plan, claude-code-guide, ...

Root Cause Analysis

The string parsing logic appears to have an off-by-one error when extracting quoted string values from pseudo-code blocks in markdown:

  • The opening " is correctly stripped
  • The closing " is incorrectly included in the extracted value

Important distinction: When Claude interprets the markdown instructions and calls the Task tool directly (via proper tool invocation), it works correctly. The bug occurs specifically when Claude Code's parser tries to automatically extract and execute Task() calls from code blocks.

Affected Use Cases

This bug affects any slash command or skill that uses the Task() pseudo-code syntax with quoted subagent_type values. This is a common pattern in:

Workaround

None known that works reliably. The bug is intermittent.

Suggested Fix

Review the regex or string parsing logic that extracts parameter values from Task() pseudo-code blocks in markdown. Ensure both opening and closing quotes are stripped from the extracted value.

View original on GitHub ↗

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