{"record":{"id":"a8e9efd7e3b3f56f","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-a8e9ef","errorCode":"MISSING_ARGUMENT","errorMessage":"reportPath is required","messagePattern":"reportPath is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/complexity-report.js","lineNumber":31,"sourceCode":" * Direct function wrapper for displaying the complexity report with error handling and caching.\n *\n * @param {Object} args - Command arguments containing reportPath.\n * @param {string} args.reportPath - Explicit path to the complexity report file.\n * @param {Object} log - Logger object\n * @returns {Promise<Object>} - Result object with success status and data/error information\n */\nexport async function complexityReportDirect(args, log) {\n\t// Destructure expected args\n\tconst { reportPath } = args;\n\ttry {\n\t\tlog.info(`Getting complexity report with args: ${JSON.stringify(args)}`);\n\n\t\t// Check if reportPath was provided\n\t\tif (!reportPath) {\n\t\t\tlog.error('complexityReportDirect called without reportPath');\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: { code: 'MISSING_ARGUMENT', message: 'reportPath is required' }\n\t\t\t};\n\t\t}\n\n\t\t// Use the provided report path\n\t\tlog.info(`Looking for complexity report at: ${reportPath}`);\n\n\t\t// Generate cache key based on report path\n\t\tconst cacheKey = `complexityReport:${reportPath}`;\n\n\t\t// Define the core action function to read the report\n\t\tconst coreActionFn = async () => {\n\t\t\ttry {\n\t\t\t\t// Enable silent mode to prevent console logs from interfering with JSON response\n\t\t\t\tenableSilentMode();\n\n\t\t\t\tconst report = readComplexityReport(reportPath);\n\n\t\t\t\t// Restore normal logging","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/complexity-report.js#L13-L49","documentation":"complexityReportDirect is the MCP direct-function wrapper for reading an existing complexity analysis report. The function requires an explicit reportPath argument because it does not guess a default report location. If reportPath is falsy (undefined, null, empty string) it short-circuits before any file I/O and returns a structured MISSING_ARGUMENT failure so the MCP tool can surface a clean message instead of crashing.","triggerScenarios":"Calling the complexity-report MCP tool without the reportPath parameter, passing reportPath: null/undefined after destructuring tool args, or building tool arguments programmatically and omitting the key.","commonSituations":"LLM clients invoking the tool with a partial arguments object; custom MCP harnesses that strip empty-string params; users who assume a default report path (.taskmaster/reports/complex-report.json) is auto-used.","solutions":["Pass reportPath explicitly, e.g. { reportPath: '.taskmaster/reports/complex-report.json' }","If no path is known, first run the analyze-complexity tool and use its returned report path","In custom callers, validate typeof args.reportPath === 'string' && args.reportPath.length > 0 before invoking","Check the MCP client config/arguments mapping so reportPath is not being dropped or renamed"],"exampleFix":"// before\nawait complexityReportDirect({});\n// after\nawait complexityReportDirect({ reportPath: '.taskmaster/reports/complex-report.json', projectRoot: process.cwd() });","handlingStrategy":"validation","validationCode":"if (typeof args.reportPath !== 'string' || args.reportPath.trim() === '') throw new Error('reportPath must be a non-empty string');","typeGuard":"function hasReportPath(a) { return typeof a === 'object' && a !== null && typeof a.reportPath === 'string' && a.reportPath.length > 0; }","tryCatchPattern":"try { const r = await complexityReportDirect(args); if (!r.success) handle(r.error); } catch (e) { /* transport-level failure */ }","preventionTips":["Always pass reportPath resolved against projectRoot","Run analyze-complexity first and reuse its output path","Validate tool args in your MCP client before dispatch"],"tags":["mcp","argument-validation","complexity-report"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}