bug: Task expansion fails with JSON parsing error when using claude-code provider #133

Closed
opened 2025-10-14 15:43:22 -06:00 by navan · 0 comments
Owner

Originally created by @Kl-11 on 9/1/2025

Task expansion fails with JSON parsing error when using claude-code provider

Description

When using the "claude-code" provider in TaskMaster config, the expand_task command fails with a JSON parsing error. The AI model returns markdown-wrapped JSON (```json) instead of raw JSON, causing the parser to fail with "Unexpected token '`'" error. This affects both individual task expansion and bulk expansion operations.

Steps to Reproduce

  1. Use taskmaster with claude code, no additional APIs. Configured via MCP.
  2. Parse a PRD to generate tasks: task-master parse-prd --input=.taskmaster/docs/prd.txt
  3. Try to expand tasks: task-master expand --id=1 --research
  4. Observe JSON parsing error

Expected Behavior

The expand_task command should successfully parse the AI response and add subtasks to the specified task. The AI model should return raw JSON that can be parsed by the JSON.parse() function.

Actual Behavior

The command fails with error:

Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token '`', "```json
{
"... is not valid JSON

The AI model using claude-code provider returns JSON wrapped in markdown code blocks instead of raw JSON.

Screenshots or Logs

Error output:

Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token '`', "```json
{
"... is not valid JSON
Version: 0.25.1
Name: task-master-ai
Current Tag: master

Environment

  • Task Master version: 0.25.1
  • Node.js version: v24.6.0
  • Operating system: macOS 26.0 (Build 25A5349a)
  • IDE (if applicable): Claude Code with MCP integration

Additional Context

  • The issue appears to be specific to the "claude-code" provider, which seems to format responses as markdown code blocks
  • Approximately 70% of tasks fail to expand (7 out of 10 failed in testing)
  • This may be related to how the claude-code provider instructs the model to format responses
  • The error occurs consistently with certain tasks but not others from the same PRD parsing session
  • Written by claude
*Originally created by @Kl-11 on 9/1/2025* # Task expansion fails with JSON parsing error when using claude-code provider ### Description When using the "claude-code" provider in TaskMaster config, the expand_task command fails with a JSON parsing error. The AI model returns markdown-wrapped JSON (```json) instead of raw JSON, causing the parser to fail with "Unexpected token '`'" error. This affects both individual task expansion and bulk expansion operations. ### Steps to Reproduce 1. Use taskmaster with claude code, no additional APIs. Configured via MCP. 2. Parse a PRD to generate tasks: `task-master parse-prd --input=.taskmaster/docs/prd.txt` 3. Try to expand tasks: `task-master expand --id=1 --research` 4. Observe JSON parsing error ### Expected Behavior The expand_task command should successfully parse the AI response and add subtasks to the specified task. The AI model should return raw JSON that can be parsed by the JSON.parse() function. ### Actual Behavior The command fails with error: ``` Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token '`', "```json { "... is not valid JSON ``` The AI model using claude-code provider returns JSON wrapped in markdown code blocks instead of raw JSON. ### Screenshots or Logs Error output: ``` Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token '`', "```json { "... is not valid JSON Version: 0.25.1 Name: task-master-ai Current Tag: master ``` ### Environment - Task Master version: 0.25.1 - Node.js version: v24.6.0 - Operating system: macOS 26.0 (Build 25A5349a) - IDE (if applicable): Claude Code with MCP integration ### Additional Context - The issue appears to be specific to the "claude-code" provider, which seems to format responses as markdown code blocks - Approximately 70% of tasks fail to expand (7 out of 10 failed in testing) - This may be related to how the claude-code provider instructs the model to format responses - The error occurs consistently with certain tasks but not others from the same PRD parsing session - Written by claude
Sign in to join this conversation.
No labels
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:ai-models
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:cli
area:installation
area:installation
area:installation
area:installation
area:installation
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:mcp
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:task-management
area:vscode-extension
area:vscode-extension
area:vscode-extension
area:vscode-extension
area:vscode-extension
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
bug
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
documentation
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
duplicate
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
enhancement
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
feedback
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
good first issue
help wanted
help wanted
help wanted
help wanted
help wanted
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
high-priority
integration request
integration request
integration request
integration request
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
invalid
low-priority
low-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
medium-priority
provider:anthropic
provider:anthropic
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:claude-code
provider:gemini-cli
provider:openai
provider:perplexity
question
question
question
question
question
question
question
question
question
question
question
question
question
question
refactor
refactor
wontfix
wontfix
wontfix
wontfix
wontfix
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/claude-task-master#133
No description provided.