bug: issue with the task-master AI response parsing in claude-code #89

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

Originally created by @PabloAraya6 on 9/19/2025

Description

task-master fails in CLAUDE CODE when updating or expanding a task because the model output is not valid JSON.
Instead of returning a strict JSON object, the response starts with natural language text (e.g., "I'll analy..."), which breaks the parser.


Steps to Reproduce

  1. Open a terminal on macOS 15.6.1 (24G90) with Node.js v23.11.0 and Task Master 0.26.0 installed.
  2. Run:
   task-master expand --id=2

  1. Alternatively:
   task-master update-task --id=2 --prompt="Break this task into 7 implementation subtasks: 1) Create worker-signup route and page structure 2) Implement Step 1 - …"
  1. Observe the parsing error.

Expected Behavior

  • The CLI should receive and parse a valid JSON object without any extra preamble or prose.
  • The task update/expansion should succeed and display the new subtasks.

Actual Behavior

  • The LLM returns additional text before the JSON object (e.g., "I'll analy...").

  • The CLI fails with a JSON parse error:

    Error: Failed to parse JSON response object: Unexpected token 'I', "I'll analy"... is not valid JSON
    

Screenshots or Logs

⏺ Bash(task-master update-task --id=2 --prompt="Break this task into 7 implementation subtasks: ...")
  ⎿  Error: - Updating task...

     Error: Failed to parse JSON response object: Unexpected token 'I', "I'll analy"... is not valid JSON
         at parseUpdatedTaskFromText (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/update-task-by-id.js:179:9)
         at updateTaskById (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/update-task-by-id.js:604:24)
         at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
⏺ Bash(task-master expand --id=2)
  ⎿  Error: - Generating 7 subtasks...

     Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token 'I', "I'll analy"... is not valid JSON
         at parseSubtasksFromText (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/expand-task.js:207:10)
         at expandTask (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/expand-task.js:571:24)

Environment

  • Task Master version: 0.26.0
  • IA: claude-code
  • Node.js version: v23.11.0
  • Operating system: macOS 15.6.1 (24G90)
  • IDE (if applicable): Claude Code

Additional Context

  • The issue is reproducible with both update-task and expand commands.
  • It appears the CLI expects a strict JSON response but does not handle extra prose from the model.
  • A more tolerant JSON parser (extracting the first valid JSON object) or structured output enforcement would likely resolve this.
  • config-file:
{
  "models": {
    "main": {
      "provider": "claude-code",
      "modelId": "sonnet",
      "maxTokens": 32000,
      "temperature": 0.1
    },
    "research": {
      "provider": "claude-code",
      "modelId": "sonnet",
      "maxTokens": 64000,
      "temperature": 0.1
    },
    "fallback": {
      "provider": "claude-code",
      "modelId": "sonnet",
      "maxTokens": 64000,
      "temperature": 0.2
    }
  },
  "global": {
    "logLevel": "debug",
    "debug": true,
    "defaultNumTasks": 10,
    "defaultSubtasks": 7,
    "defaultPriority": "medium",
    "projectName": "Taskmaster",
    "ollamaBaseURL": "http://localhost:11434/api",
    "bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
    "responseLanguage": "English",
    "enableCodebaseAnalysis": true,
    "defaultTag": "master",
    "azureOpenaiBaseURL": "https://your-endpoint.openai.azure.com/",
    "userId": "1234567890",
    "enforceJsonOutput": true,
    "jsonRepairMode": true
  },
  "claudeCode": {
    "maxTurns": 5,
    "customSystemPrompt": "You are a helpful assistant focused on code quality",
    "appendSystemPrompt": "Always follow coding best practices",
    "permissionMode": "default",
    "allowedTools": ["Read", "LS"],
    "disallowedTools": ["Write", "Edit"],
    "mcpServers": {
      "mcp-server-name": {
        "command": "npx",
        "args": ["-y", "mcp-serve"],
        "env": {
        }
      }
    }
  },
  "commandSpecific": {
    "parse-prd": {
      "maxTurns": 10,
      "customSystemPrompt": "You are a task breakdown specialist"
    },
    "analyze-complexity": {
      "maxTurns": 3,
      "customSystemPrompt": "CRITICAL: You must output ONLY valid JSON. No explanations, no 'I will', no 'I'll analyze', no text before or after JSON. Your response must start with '[' and end with ']'. The output will be parsed with JSON.parse() and any non-JSON content will cause system failure.",
      "appendSystemPrompt": "JSON ONLY. Format: [{\"task\":\"string\",\"complexity\":\"low|medium|high\",\"bottlenecks\":[\"string\"]}]. Start immediately with '['."
    }
  }
}
*Originally created by @PabloAraya6 on 9/19/2025* ### Description `task-master` fails in CLAUDE CODE when updating or expanding a task because the model output is not valid JSON. Instead of returning a strict JSON object, the response starts with natural language text (e.g., `"I'll analy..."`), which breaks the parser. --- ### Steps to Reproduce 1. Open a terminal on **macOS 15.6.1 (24G90)** with **Node.js v23.11.0** and **Task Master 0.26.0** installed. 2. Run: ```bash task-master expand --id=2 ``` 3. Alternatively: ```bash task-master update-task --id=2 --prompt="Break this task into 7 implementation subtasks: 1) Create worker-signup route and page structure 2) Implement Step 1 - …" ``` 4. Observe the parsing error. --- ### Expected Behavior * The CLI should receive and parse a valid JSON object without any extra preamble or prose. * The task update/expansion should succeed and display the new subtasks. --- ### Actual Behavior * The LLM returns additional text before the JSON object (e.g., `"I'll analy..."`). * The CLI fails with a **JSON parse error**: ``` Error: Failed to parse JSON response object: Unexpected token 'I', "I'll analy"... is not valid JSON ``` --- ### Screenshots or Logs ``` ⏺ Bash(task-master update-task --id=2 --prompt="Break this task into 7 implementation subtasks: ...") ⎿ Error: - Updating task... Error: Failed to parse JSON response object: Unexpected token 'I', "I'll analy"... is not valid JSON at parseUpdatedTaskFromText (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/update-task-by-id.js:179:9) at updateTaskById (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/update-task-by-id.js:604:24) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) ``` ``` ⏺ Bash(task-master expand --id=2) ⎿ Error: - Generating 7 subtasks... Error: Failed to parse JSON response object after both simple and advanced attempts: Unexpected token 'I', "I'll analy"... is not valid JSON at parseSubtasksFromText (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/expand-task.js:207:10) at expandTask (file:///opt/homebrew/lib/node_modules/task-master-ai/scripts/modules/task-manager/expand-task.js:571:24) ``` --- ### Environment * **Task Master version:** 0.26.0 * **IA**: claude-code * **Node.js version:** v23.11.0 * **Operating system:** macOS 15.6.1 (24G90) * **IDE (if applicable):** Claude Code --- ### Additional Context * The issue is reproducible with both `update-task` and `expand` commands. * It appears the CLI expects a strict JSON response but does not handle extra prose from the model. * A more tolerant JSON parser (extracting the first valid JSON object) or structured output enforcement would likely resolve this. * config-file: ```json { "models": { "main": { "provider": "claude-code", "modelId": "sonnet", "maxTokens": 32000, "temperature": 0.1 }, "research": { "provider": "claude-code", "modelId": "sonnet", "maxTokens": 64000, "temperature": 0.1 }, "fallback": { "provider": "claude-code", "modelId": "sonnet", "maxTokens": 64000, "temperature": 0.2 } }, "global": { "logLevel": "debug", "debug": true, "defaultNumTasks": 10, "defaultSubtasks": 7, "defaultPriority": "medium", "projectName": "Taskmaster", "ollamaBaseURL": "http://localhost:11434/api", "bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com", "responseLanguage": "English", "enableCodebaseAnalysis": true, "defaultTag": "master", "azureOpenaiBaseURL": "https://your-endpoint.openai.azure.com/", "userId": "1234567890", "enforceJsonOutput": true, "jsonRepairMode": true }, "claudeCode": { "maxTurns": 5, "customSystemPrompt": "You are a helpful assistant focused on code quality", "appendSystemPrompt": "Always follow coding best practices", "permissionMode": "default", "allowedTools": ["Read", "LS"], "disallowedTools": ["Write", "Edit"], "mcpServers": { "mcp-server-name": { "command": "npx", "args": ["-y", "mcp-serve"], "env": { } } } }, "commandSpecific": { "parse-prd": { "maxTurns": 10, "customSystemPrompt": "You are a task breakdown specialist" }, "analyze-complexity": { "maxTurns": 3, "customSystemPrompt": "CRITICAL: You must output ONLY valid JSON. No explanations, no 'I will', no 'I'll analyze', no text before or after JSON. Your response must start with '[' and end with ']'. The output will be parsed with JSON.parse() and any non-JSON content will cause system failure.", "appendSystemPrompt": "JSON ONLY. Format: [{\"task\":\"string\",\"complexity\":\"low|medium|high\",\"bottlenecks\":[\"string\"]}]. Start immediately with '['." } } } ```
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#89
No description provided.