{"record":{"id":"dc0195ab34d7a1fb","repo":"eyaltoledano/claude-task-master","slug":"unexpected-error","errorCode":"UNEXPECTED_ERROR","errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/complexity-report.js","lineNumber":98,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t};\n\n\t\t// Use the caching utility\n\t\ttry {\n\t\t\tconst result = await coreActionFn();\n\t\t\tlog.info('complexityReportDirect completed');\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\t// Ensure silent mode is disabled\n\t\t\tdisableSilentMode();\n\n\t\t\tlog.error(`Unexpected error during complexityReport: ${error.message}`);\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'UNEXPECTED_ERROR',\n\t\t\t\t\tmessage: error.message\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\t// Ensure silent mode is disabled if an outer error occurs\n\t\tdisableSilentMode();\n\n\t\tlog.error(`Error in complexityReportDirect: ${error.message}`);\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'UNEXPECTED_ERROR',\n\t\t\t\tmessage: error.message\n\t\t\t}\n\t\t};\n\t}\n}","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/complexity-report.js#L80-L116","documentation":"This is the inner generic catch of complexityReportDirect's coreActionFn: any unexpected error thrown during report handling that is not a read error is wrapped as UNEXPECTED_ERROR with the raw error message. It is a catch-all so the MCP layer always receives a structured result.","triggerScenarios":"Exceptions from core logic after the report is loaded — e.g. data transformation failures, code thrown by helpers invoked with unexpected report shapes, or bugs in the complexity analysis package itself.","commonSituations":"Report JSON is structurally valid but missing expected fields after a version change; a dependency upgrade changed the report shape; passing unexpected extra args that downstream code assumes are typed.","solutions":["Inspect the message field for the underlying exception and fix its cause","Regenerate the report with the current version of analyze-complexity so the shape matches","Pin/align versions of task-master-ai so MCP server and core use the same report schema","Reproduce locally by calling the direct function with the same args to get a full stack trace"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (typeof args !== 'object' || args === null) throw new Error('args must be an object');","typeGuard":null,"tryCatchPattern":"const res = await complexityReportDirect(args); if (!res.success && res.error.code === 'UNEXPECTED_ERROR') { console.error(res.error.message); }","preventionTips":["Keep task-master-ai versions aligned across core and MCP server","Test direct functions locally with the same args as production","Avoid hand-editing report files; always regenerate via the tool"],"tags":["mcp","unexpected-error","complexity-report"],"backgroundTag":"unexpected-internal-error","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}