{"record":{"id":"894c7025b126dbcb","repo":"eyaltoledano/claude-task-master","slug":"update-subtask-core-error","errorCode":"UPDATE_SUBTASK_CORE_ERROR","errorMessage":"error.message || 'Unknown error updating subtask'","messagePattern":"error\\.message \\|\\| 'Unknown error updating subtask'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/update-subtask-by-id.js","lineNumber":140,"sourceCode":"\t\t\treturn {\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: {\n\t\t\t\t\tmessage: `Successfully updated subtask with ID ${subtaskIdStr}`,\n\t\t\t\t\tsubtaskId: subtaskIdStr,\n\t\t\t\t\tparentId: parentId,\n\t\t\t\t\tsubtask: coreResult.updatedSubtask,\n\t\t\t\t\ttasksPath,\n\t\t\t\t\tuseResearch,\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 subtask 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_SUBTASK_CORE_ERROR',\n\t\t\t\t\tmessage: error.message || 'Unknown error updating subtask'\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(\n\t\t\t`Setup error in updateSubtaskByIdDirect: ${error.message}`\n\t\t);\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'","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/update-subtask-by-id.js#L122-L158","documentation":"Catch-all in updateSubtaskByIdDirect's inner try: any exception thrown while performing the update (file I/O, JSON parse, core updateSubtask failure) is converted into an UPDATE_SUBTASK_CORE_ERROR result with error.message. The finally block restores logging state if silent mode was enabled. It indicates the update attempt itself failed, distinct from validation or not-found outcomes.","triggerScenarios":"tasks.json unreadable or malformed, permission denied writing the file, the core updateSubtask call throwing on storage errors, or concurrent modification corrupting the read-modify-write cycle.","commonSituations":"File locked by another process/IDE sync, running the MCP server as a user without write access to .taskmaster/, hand-edited tasks.json with a syntax error.","solutions":["Read error.message in the result to get the underlying cause.","Validate tasks.json parses (e.g. `node -e \"JSON.parse(require('fs').readFileSync(path))\"`).","Check file permissions on the tasks file and its directory.","Ensure no other process is concurrently rewriting tasks.json during the update."],"exampleFix":"// before\n// tasks.json has a trailing comma -> parse throws\n{ \"tasks\": [ ... ], }\n// after\n{ \"tasks\": [ ... ] }","handlingStrategy":"try-catch","validationCode":"try { JSON.parse(fs.readFileSync(tasksJsonPath, 'utf8')); } catch (e) { throw new Error(`tasks.json malformed: ${e.message}`); }\nfs.accessSync(tasksJsonPath, fs.constants.W_OK); // throws if not writable","typeGuard":"function isResultOk(r) { return r !== null && typeof r === 'object' && r.success === true; }","tryCatchPattern":"const res = await updateSubtaskByIdDirect(args);\nif (!res.success && res.error.code === 'UPDATE_SUBTASK_CORE_ERROR') {\n  console.error('Update failed:', res.error.message);\n  // check file parse, permissions, concurrent writers\n}","preventionTips":["Validate tasks.json parses before every write operation","Check write permissions for the user running the MCP server","Avoid running multiple agents writing to tasks.json concurrently"],"tags":["mcp","unhandled-exception","file-io"],"backgroundTag":"operation-failed-catch-all","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}