eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

projectRoot is required.

What it means

updateTasksDirect (bulk update-task tool) requires projectRoot because it is used for env/MCP context and path resolution. When args.projectRoot is falsy the call is rejected immediately with code MISSING_ARGUMENT before any core work happens.

Source

Thrown at mcp-server/src/core/direct-functions/update-tasks.js:41

 * @param {string} args.tag - Tag for the task (optional)
 * @param {Object} log - Logger object.
 * @param {Object} context - Context object containing session data.
 * @returns {Promise<Object>} - Result object with success status and data/error information.
 */
export async function updateTasksDirect(args, log, context = {}) {
	const { session } = context;
	const { from, prompt, research, tasksJsonPath, projectRoot, tag } = args;

	// Create the standard logger wrapper
	const logWrapper = createLogWrapper(log);

	// --- Input Validation ---
	if (!projectRoot) {
		logWrapper.error('updateTasksDirect requires a projectRoot argument.');
		return {
			success: false,
			error: {
				code: 'MISSING_ARGUMENT',
				message: 'projectRoot is required.'
			}
		};
	}

	if (!from) {
		logWrapper.error('updateTasksDirect called without from ID');
		return {
			success: false,
			error: {
				code: 'MISSING_ARGUMENT',
				message: 'Starting task ID (from) is required'
			}
		};
	}

	if (!prompt) {
		logWrapper.error('updateTasksDirect called without prompt');

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the absolute project root: { from: '5', prompt: 'x', projectRoot: '/abs/path/to/project' }
  2. Configure the MCP client to send projectRoot (it is derived from the workspace root in normal MCP usage)
  3. Check that your client version populates projectRoot; upgrade the task-master MCP server/client pair if it never sends it

Example fix

// before
await updateTasksDirect({ from: '5', prompt: 'Add tests' }, log);
// after
await updateTasksDirect({ from: '5', prompt: 'Add tests', projectRoot: '/home/me/myproject' }, log);
Defensive patterns

Strategy: validation

Validate before calling

function assertProjectRoot(args) {
  if (!args.projectRoot || typeof args.projectRoot !== 'string') {
    throw new Error('projectRoot is required.');
  }
}

Type guard

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

Try / catch

if (!hasProjectRoot(args)) {
  console.error('Pass projectRoot (absolute path to repo root)');
  return;
}
const result = await updateTasksDirect(args, log);
if (!result.success && result.error.code === 'MISSING_ARGUMENT') console.error(result.error.message);

Prevention

When it happens

Trigger: Calling the update_tasks MCP tool without projectRoot, or with projectRoot: '' / null / undefined in args.

Common situations: MCP client omitting projectRoot because the tool schema marks it optional; calling the direct function from custom scripts; running the server outside any project directory so no default root is injected.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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