{"record":{"id":"769b00ab08819581","repo":"eyaltoledano/claude-task-master","slug":"update-task-core-error","errorCode":"UPDATE_TASK_CORE_ERROR","errorMessage":"error.message || 'Unknown error updating task'","messagePattern":"error\\.message \\|\\| 'Unknown error updating task'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/update-task-by-id.js","lineNumber":172,"sourceCode":"\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: {\n\t\t\t\t\tmessage: successMessage,\n\t\t\t\t\ttaskId: taskId,\n\t\t\t\t\ttasksPath: tasksPath,\n\t\t\t\t\tuseResearch: useResearch,\n\t\t\t\t\tupdated: true,\n\t\t\t\t\tupdatedTask: coreResult.updatedTask,\n\t\t\t\t\ttelemetryData: coreResult.telemetryData,\n\t\t\t\t\ttagInfo: coreResult.tagInfo\n\t\t\t\t}\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tlogWrapper.error(`Error updating task by ID: ${error.message}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'UPDATE_TASK_CORE_ERROR',\n\t\t\t\t\tmessage: error.message || 'Unknown error updating task'\n\t\t\t\t}\n\t\t\t};\n\t\t} finally {\n\t\t\tif (!wasSilent && isSilentMode()) {\n\t\t\t\tdisableSilentMode();\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tlogWrapper.error(`Setup error in updateTaskByIdDirect: ${error.message}`);\n\t\tif (isSilentMode()) disableSilentMode();\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'DIRECT_FUNCTION_SETUP_ERROR',\n\t\t\t\tmessage: error.message || 'Unknown setup error'\n\t\t\t}\n\t\t};","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/update-task-by-id.js#L154-L190","documentation":"Generic catch-all inside updateTaskByIdDirect: any exception thrown by the core updateTaskById call (file parsing, AI API failure, task not found, storage errors) is returned as an MCP error result with code UPDATE_TASK_CORE_ERROR and the underlying error message.","triggerScenarios":"Core updateTaskById throws after validation passes: tasks.json is malformed JSON, the id does not resolve to a task, the AI provider API call fails or is unauthenticated, or filesystem write errors occur.","commonSituations":"Missing/invalid API keys (ANTHROPIC_API_KEY etc.); corrupted tasks.json; updating a nonexistent task id; network outage during AI call; read-only filesystem.","solutions":["Read the returned message for the root cause (e.g. 'Task with id 99 not found' vs API auth error)","Verify the task id exists in tasks.json (task-master list)","Check API key env vars and network access if the message mentions the AI provider","Validate tasks.json parses as JSON (task-master parse or jq)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { readFileSync } from 'fs';\nfunction preflight(tasksPath, taskId) {\n  const db = JSON.parse(readFileSync(tasksPath, 'utf8'));\n  return db.tasks?.some(t => String(t.id) === String(taskId));\n}","typeGuard":null,"tryCatchPattern":"const result = await updateTaskByIdDirect(args, log);\nif (!result.success) {\n  if (result.error.code === 'UPDATE_TASK_CORE_ERROR') {\n    console.error(`Task update failed: ${result.error.message}`);\n    // inspect cause: missing id, bad tasks.json, or AI/API failure\n  }\n}","preventionTips":["Verify the task id exists before updating","Keep API keys set in the MCP server environment","Ensure tasks.json is valid JSON and writable","Read the surfaced error.message — it carries the core root cause"],"tags":["core-function","error-wrapping","mcp"],"backgroundTag":"core-function-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}