eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

reportPath is required

What it means

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.

Source

Thrown at mcp-server/src/core/direct-functions/complexity-report.js:31

 * Direct function wrapper for displaying the complexity report with error handling and caching.
 *
 * @param {Object} args - Command arguments containing reportPath.
 * @param {string} args.reportPath - Explicit path to the complexity report file.
 * @param {Object} log - Logger object
 * @returns {Promise<Object>} - Result object with success status and data/error information
 */
export async function complexityReportDirect(args, log) {
	// Destructure expected args
	const { reportPath } = args;
	try {
		log.info(`Getting complexity report with args: ${JSON.stringify(args)}`);

		// Check if reportPath was provided
		if (!reportPath) {
			log.error('complexityReportDirect called without reportPath');
			return {
				success: false,
				error: { code: 'MISSING_ARGUMENT', message: 'reportPath is required' }
			};
		}

		// Use the provided report path
		log.info(`Looking for complexity report at: ${reportPath}`);

		// Generate cache key based on report path
		const cacheKey = `complexityReport:${reportPath}`;

		// Define the core action function to read the report
		const coreActionFn = async () => {
			try {
				// Enable silent mode to prevent console logs from interfering with JSON response
				enableSilentMode();

				const report = readComplexityReport(reportPath);

				// Restore normal logging

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass reportPath explicitly, e.g. { reportPath: '.taskmaster/reports/complex-report.json' }
  2. If no path is known, first run the analyze-complexity tool and use its returned report path
  3. In custom callers, validate typeof args.reportPath === 'string' && args.reportPath.length > 0 before invoking
  4. Check the MCP client config/arguments mapping so reportPath is not being dropped or renamed

Example fix

// before
await complexityReportDirect({});
// after
await complexityReportDirect({ reportPath: '.taskmaster/reports/complex-report.json', projectRoot: process.cwd() });
Defensive patterns

Strategy: validation

Validate before calling

if (typeof args.reportPath !== 'string' || args.reportPath.trim() === '') throw new Error('reportPath must be a non-empty string');

Type guard

function hasReportPath(a) { return typeof a === 'object' && a !== null && typeof a.reportPath === 'string' && a.reportPath.length > 0; }

Try / catch

try { const r = await complexityReportDirect(args); if (!r.success) handle(r.error); } catch (e) { /* transport-level failure */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/a8e9efd7e3b3f56f. Report an issue: GitHub.