eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

projectRoot is required.

What it means

parsePRDDirect requires a `projectRoot` argument and rejects the call up front when it is falsy (parse-prd.js:52-61). projectRoot anchors all path resolution — PRD input, output tasks.json, and config defaults — so without it the function cannot resolve any filesystem paths safely.

Source

Thrown at mcp-server/src/core/direct-functions/parse-prd.js:57

		output: outputArg,
		numTasks: numTasksArg,
		force,
		append,
		research,
		projectRoot,
		tag
	} = args;

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

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

	// Resolve input path using path utilities
	let inputPath;
	if (inputArg) {
		try {
			inputPath = resolvePrdPath({ input: inputArg, projectRoot }, session);
		} catch (error) {
			logWrapper.error(`Error resolving PRD path: ${error.message}`);
			return {
				success: false,
				error: { code: 'FILE_NOT_FOUND', message: error.message }
			};
		}
	} else {

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the absolute path to your project root as `projectRoot`.
  2. If you are the tool caller, ensure the MCP client forwards projectRoot (it is a required arg for parse_prd).
  3. If root is dynamic, resolve it before the call (e.g. process.cwd() or the directory containing .taskmaster/).

Example fix

// before
await parsePRDDirect({ input: './docs/prd.txt' }, log);

// after
await parsePRDDirect({ input: './docs/prd.txt', projectRoot: '/abs/path/to/project' }, log);
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
if (!args?.projectRoot) throw new Error('projectRoot is required');
if (!fs.existsSync(args.projectRoot)) throw new Error(`projectRoot does not exist: ${args.projectRoot}`);

Type guard

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

Prevention

When it happens

Trigger: Calling the MCP `parse_prd` tool without `projectRoot` in args, or with an empty-string projectRoot; calling parsePRDDirect directly from code and forgetting the argument.

Common situations: Custom MCP clients or agents constructing tool arguments manually and omitting projectRoot; callers that assumed the server would infer the root from the session/cwd but called the direct function directly, which does no inference.

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