{"record":{"id":"cfa11d5dabfa94d0","repo":"eyaltoledano/claude-task-master","slug":"set-status-error","errorCode":"SET_STATUS_ERROR","errorMessage":"error.message || 'Unknown error setting task status'","messagePattern":"error\\.message \\|\\| 'Unknown error setting task status'","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/set-task-status.js","lineNumber":139,"sourceCode":"\t\t\t\t\t\t\tnextSteps: nextResult.data.nextSteps\n\t\t\t\t\t\t};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.warn(\n\t\t\t\t\t\t\t`Failed to retrieve next task: ${nextResult.error?.message || 'Unknown error'}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} catch (nextErr) {\n\t\t\t\t\tlog.error(`Error retrieving next task: ${nextErr.message}`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tlog.error(`Error setting task status: ${error.message}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'SET_STATUS_ERROR',\n\t\t\t\t\tmessage: error.message || 'Unknown error setting task status'\n\t\t\t\t}\n\t\t\t};\n\t\t} finally {\n\t\t\t// ALWAYS restore normal logging in finally block\n\t\t\tdisableSilentMode();\n\t\t}\n\t} catch (error) {\n\t\t// Ensure silent mode is disabled if there was an uncaught error in the outer try block\n\t\tif (isSilentMode()) {\n\t\t\tdisableSilentMode();\n\t\t}\n\n\t\tlog.error(`Error setting task status: ${error.message}`);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'SET_STATUS_ERROR',","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/set-task-status.js#L121-L157","documentation":"Generic catch-all inside setTaskStatusDirect: any exception thrown by the inner status-update logic (path resolution, file read/write, core updateTaskStatus call) is caught and converted into a SET_STATUS_ERROR result carrying error.message. The finally block restores normal logging after silent mode. It tells you the status update failed for a reason other than input validation.","triggerScenarios":"The core updateTaskStatus call throws: tasks.json path is wrong or the file is missing, JSON is malformed, the task ID does not resolve, or the status value is not in the allowed set and the core layer rejects it.","commonSituations":"Running the MCP server from a different working directory so the relative tasks path no longer resolves; a hand-edited tasks.json with invalid JSON; typo'd status values like 'completed' instead of 'done'.","solutions":["Read error.message in the result — it carries the underlying cause; fix that root cause first.","Confirm the tasksJsonPath/tool argument points at an existing, valid tasks.json.","Use a valid status constant from the library (pending, done, in-progress, review, deferred, cancelled).","Enable verbose logging or retry after disabling silent mode to get the full stack."],"exampleFix":"// before\nconst tasksPath = './data/tasks.json'; // file does not exist\n// after\nconst tasksPath = path.resolve(process.cwd(), '.taskmaster/tasks/tasks.json');","handlingStrategy":"try-catch","validationCode":"if (!fs.existsSync(tasksPath)) throw new Error(`tasks.json not found at ${tasksPath}`);\nJSON.parse(fs.readFileSync(tasksPath, 'utf8')); // throws on malformed JSON","typeGuard":"function isResultOk(r) { return r !== null && typeof r === 'object' && r.success === true; }","tryCatchPattern":"const res = await setTaskStatusDirect(args);\nif (!res.success) {\n  if (res.error.code === 'SET_STATUS_ERROR') {\n    console.error('Status update failed:', res.error.message);\n    // inspect path, file validity, status value\n  }\n}","preventionTips":["Always resolve tasksJsonPath to an absolute path before calling","Validate status values against the known set before invoking","Keep silent mode off while debugging to get full error output"],"tags":["mcp","unhandled-exception","task-status"],"backgroundTag":"operation-failed-catch-all","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}