eyaltoledano/claude-task-master · error

prdFilePath is required and must be a non-empty string

Error message

prdFilePath is required and must be a non-empty string

What it means

displayParsePrdStart validates that a PRD file path was supplied before rendering the parse-prd progress UI. It throws when prdFilePath is missing, not a string, or an empty/whitespace-only string. This is an input-contract guard so the UI never renders a start banner for an unusable path.

Source

Thrown at src/ui/parse-prd.js:164

function displayParsePrdStart({
	prdFilePath,
	outputPath,
	numTasks,
	model = CONSTANTS.DEFAULT_MODEL,
	temperature = CONSTANTS.DEFAULT_TEMPERATURE,
	append = false,
	research = false,
	force = false,
	existingTasks = [],
	nextId = 1
}) {
	// Input validation
	if (
		!prdFilePath ||
		typeof prdFilePath !== 'string' ||
		prdFilePath.trim() === ''
	) {
		throw new Error('prdFilePath is required and must be a non-empty string');
	}
	if (
		!outputPath ||
		typeof outputPath !== 'string' ||
		outputPath.trim() === ''
	) {
		throw new Error('outputPath is required and must be a non-empty string');
	}

	// Build and display the main message box
	const message = buildMainMessage({
		prdFilePath,
		outputPath,
		numTasks,
		model,
		temperature,
		append,
		research

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass a valid prdFilePath string argument, e.g. displayParsePrdStart('.taskmaster/prd.txt', outputDir, options)
  2. Check the CLI/config layer that resolves the PRD path and ensure it defaults to '.taskmaster/prd.txt' or fails earlier with a friendly message
  3. Log the value before the call to confirm it is a non-empty string (typeof v === 'string' && v.trim() !== '')

Example fix

// before
displayParsePrdStart(options.prdPath, options.output, options);
// after
if (typeof options.prdPath !== 'string' || options.prdPath.trim() === '') {
  console.error('A PRD file path is required (--prd <file>)');
  process.exit(1);
}
displayParsePrdStart(options.prdPath, options.output, options);
Defensive patterns

Strategy: validation

Validate before calling

function isNonEmptyString(v) { return typeof v === 'string' && v.trim() !== ''; }
if (!isNonEmptyString(prdFilePath)) throw new TypeError('prdFilePath must be a non-empty string before calling displayParsePrdStart');

Type guard

const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;

Try / catch

try {
  displayParsePrdStart(prdFilePath, outputPath, options);
} catch (err) {
  if (err.message.startsWith('prdFilePath is required')) {
    console.error('Invalid PRD path:', prdFilePath);
    process.exitCode = 1;
  } else throw err;
}

Prevention

When it happens

Trigger: Calling displayParsePrdStart (directly or via setupProgressTracking) with prdFilePath undefined/null, a non-string value (e.g. an options object property that was never set), or a string of only whitespace such as ' '.

Common situations: CLI flag --prd omitted while options object still forwarded; config file where prd key is empty; programmatic use passing process.env.PRD_PATH when the env var is unset (undefined); refactors that renamed the option but left the old lookup returning undefined.

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