eyaltoledano/claude-task-master · error

Project root override is not a valid taskmaster project: ${r

Error message

Project root override is not a valid taskmaster project: ${resolvedOverride}

What it means

After confirming the projectRoot override exists, initTaskMaster() checks it is actually a taskmaster project: it must contain either the TASKMASTER_DIR directory (e.g. .taskmaster) or the legacy config file. A valid but non-taskmaster directory (random folder, empty checkout, wrong repo) fails this validation with the resolved path in the message.

Source

Thrown at src/task-master.js:245

	// Project Root
	if (overrides.projectRoot) {
		const resolvedOverride = path.resolve(overrides.projectRoot);
		if (!fs.existsSync(resolvedOverride)) {
			throw new Error(
				`Project root override path does not exist: ${resolvedOverride}`
			);
		}

		const hasTaskmasterDir = fs.existsSync(
			path.join(resolvedOverride, TASKMASTER_DIR)
		);
		const hasLegacyConfig = fs.existsSync(
			path.join(resolvedOverride, LEGACY_CONFIG_FILE)
		);

		if (!hasTaskmasterDir && !hasLegacyConfig) {
			throw new Error(
				`Project root override is not a valid taskmaster project: ${resolvedOverride}`
			);
		}

		paths.projectRoot = resolvedOverride;
	} else {
		// findProjectRoot now always returns a value (fallback to cwd)
		paths.projectRoot = findProjectRoot();
	}

	// TaskMaster Directory
	if ('taskMasterDir' in overrides) {
		paths.taskMasterDir = resolvePath(
			'taskmaster directory',
			overrides.taskMasterDir,
			[TASKMASTER_DIR],
			paths.projectRoot
		);

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run task-master init in that directory to create the .taskmaster structure (or the legacy config file).
  2. Point projectRoot at the actual project directory containing .taskmaster/, not a parent or sibling.
  3. Copy/restore the .taskmaster directory (it may be git-ignored and missing on fresh clones).
  4. Verify with ls <root>/.taskmaster that the marker directory is present.

Example fix

// before
taskMaster({ projectRoot: '/repo' });            // repo root, project is /repo/packages/app
taskMaster({ projectRoot: '/repo/apps/cli' });   // subdir without .taskmaster
// after
taskMaster({ projectRoot: '/repo/apps/app-with-taskmaster' });
// or run: cd /repo/apps/app-with-taskmaster && task-master init
Defensive patterns

Strategy: validation

Validate before calling

function assertIsTaskmasterProject(root) {
  const resolved = path.resolve(root);
  const ok =
    fs.existsSync(path.join(resolved, '.taskmaster')) ||
    fs.existsSync(path.join(resolved, 'taskmaster.config.json'));
  if (!ok) {
    throw new Error(`${resolved} is not a taskmaster project — run 'task-master init'`);
  }
}
assertIsTaskmasterProject(cfg.projectRoot);

Try / catch

try {
  const tm = taskMaster({ projectRoot: cfg.projectRoot });
} catch (err) {
  if (err.message.startsWith('Project root override is not a valid taskmaster project')) {
    console.error(err.message);
    console.error("Fix: run 'task-master init' in that directory, or point projectRoot at the directory containing .taskmaster/");
    process.exit(1);
  }
  throw err;
}

Prevention

When it happens

Trigger: projectRoot points at a fresh repo where task-master init was never run; pointing at a parent directory containing the project rather than the project itself; pointing at a subdir of the project that lacks .taskmaster/; project migrated away from legacy config without creating TASKMASTER_DIR.

Common situations: Mono-repo misconfiguration where projectRoot is the repo root but taskmaster lives in a package subdirectory; fresh CI checkouts skipping the init step; typos landing in a sibling directory that exists but isn't initialized.

Related errors


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