eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

tasksJsonPath is required

What it means

expandTaskDirect requires tasksJsonPath to load the tasks file for the task being expanded. A missing/empty argument fails fast with this MISSING_ARGUMENT structured error before any file access.

Source

Thrown at mcp-server/src/core/direct-functions/expand-task.js:66

	} = args;

	// Log session root data for debugging
	log.info(
		`Session data in expandTaskDirect: ${JSON.stringify({
			hasSession: !!session,
			sessionKeys: session ? Object.keys(session) : [],
			roots: session?.roots,
			rootsStr: JSON.stringify(session?.roots)
		})}`
	);

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

	// Use provided path
	const tasksPath = tasksJsonPath;

	log.info(`[expandTaskDirect] Using tasksPath: ${tasksPath}`);

	// Validate task ID
	const taskId = id ? parseInt(id, 10) : null;
	if (!taskId) {
		log.error('Task ID is required');
		return {
			success: false,
			error: {
				code: 'INPUT_VALIDATION_ERROR',

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Supply tasksJsonPath explicitly, e.g. '/repo/.taskmaster/tasks.json'.
  2. Launch the MCP server with the correct project root so the path resolves automatically.
  3. Confirm the tasks file exists and pass its absolute path.
  4. Inspect the exact arguments dict at the call site for a dropped/misspelled key.

Example fix

// before
await expandTaskDirect({ id: '3' });
// after
await expandTaskDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json', id: '3' });
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function assertExpandArgs(args) {
  if (!args.tasksJsonPath || !fs.existsSync(args.tasksJsonPath)) {
    throw new Error('expand_task requires an existing tasksJsonPath');
  }
  if (!args.id || Number.isNaN(parseInt(args.id, 10))) {
    throw new Error('expand_task requires a numeric task id');
  }
}

Type guard

function isExpandTaskInput(a) {
  return typeof a.tasksJsonPath === 'string' && a.tasksJsonPath.length > 0;
}

Try / catch

const res = await expandTaskDirect(args);
if (!res.success && res.error?.code === 'MISSING_ARGUMENT') {
  // recover by resolving the default path and retrying once
  res2 = await expandTaskDirect({ ...args, tasksJsonPath: defaultTasksPath });
}

Prevention

When it happens

Trigger: Calling the expand_task MCP tool without tasksJsonPath; custom MCP server wiring not resolving the path from projectRoot; direct invocation from scripts/tests omitting the field.

Common situations: Server launched with wrong cwd so path inference returns undefined; arguments built by template missing the field; users following outdated tool-call examples.

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