eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

tasksJsonPath is required

What it means

expandAllTasksDirect requires tasksJsonPath to know which tasks file to expand. Missing or empty path triggers this MISSING_ARGUMENT structured error before silent mode is enabled or any core function runs.

Source

Thrown at mcp-server/src/core/direct-functions/expand-all-tasks.js:58

	// Create logger wrapper using the utility
	const mcpLog = createLogWrapper(log);

	// Use provided complexity report path or compute it
	const complexityReportPath =
		providedComplexityReportPath ||
		resolveComplexityReportOutputPath(null, { projectRoot, tag }, log);

	log.info(
		`Expand all tasks will use complexity report at: ${complexityReportPath}`
	);

	if (!tasksJsonPath) {
		log.error('expandAllTasksDirect called without tasksJsonPath');
		return {
			success: false,
			error: {
				code: 'MISSING_ARGUMENT',
				message: 'tasksJsonPath is required'
			}
		};
	}

	enableSilentMode(); // Enable silent mode for the core function call
	try {
		log.info(
			`Calling core expandAllTasks with args: ${JSON.stringify({ num, research, prompt, force, projectRoot, tag })}`
		);

		// Parse parameters (ensure correct types)
		const numSubtasks = num ? parseInt(num, 10) : undefined;
		const useResearch = research === true;
		const additionalContext = prompt || '';
		const forceFlag = force === true;

		// Call the core function, passing options and the context object { session, mcpLog, projectRoot, tag, complexityReportPath }

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass tasksJsonPath explicitly: { tasksJsonPath: '/repo/.taskmaster/tasks.json' }.
  2. Restart the MCP server from the project root so path auto-resolution works.
  3. Verify the tasks file exists at the expected location before calling.
  4. Check server launch env/config (project root variables) that feed default path resolution.

Example fix

// before
await expandAllTasksDirect({});
// after
await expandAllTasksDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json' });
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function assertExpandAllArgs(args) {
  if (typeof args.tasksJsonPath !== 'string' || !fs.existsSync(args.tasksJsonPath)) {
    throw new Error(`tasksJsonPath missing or file not found: ${args.tasksJsonPath}`);
  }
}

Type guard

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

Try / catch

if (!canExpandAll(args)) {
  return { success: false, error: { code: 'MISSING_ARGUMENT', message: 'tasksJsonPath is required' } };
}
const res = await expandAllTasksDirect(args);

Prevention

When it happens

Trigger: Invoking the expand_all MCP tool with no tasksJsonPath argument, or a custom MCP server whose path resolution (projectRoot/env) yields undefined; direct-function calls in scripts omitting the field.

Common situations: MCP server started outside the project so default path detection fails; renamed or relocated .taskmaster/tasks.json without updating config; automated pipelines constructing tool arguments programmatically and skipping optional-looking fields.

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/6e78ad9ea292ba7a. Report an issue: GitHub.