-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
area:ai-modelsAI model integration and configurationAI model integration and configurationarea:cliCLI functionalityCLI functionalityarea:task-managementCore task management featuresCore task management featuresbugSomething isn't workingSomething isn't workinghigh-priorityUrgent issue requiring immediate attentionUrgent issue requiring immediate attentionprovider:claude-codeClaude Code integrated modelsClaude Code integrated models
Description
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
- Open a terminal on macOS 15.6.1 (24G90) with Node.js v23.11.0 and Task Master 0.26.0 installed.
- Run:
task-master expand --id=2
- 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 - …"- 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-taskandexpandcommands. - 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 '['."
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:ai-modelsAI model integration and configurationAI model integration and configurationarea:cliCLI functionalityCLI functionalityarea:task-managementCore task management featuresCore task management featuresbugSomething isn't workingSomething isn't workinghigh-priorityUrgent issue requiring immediate attentionUrgent issue requiring immediate attentionprovider:claude-codeClaude Code integrated modelsClaude Code integrated models
Projects
Status
Done