eyaltoledano/claude-task-master · error

FILE_NOT_FOUND

FILE_NOT_FOUND

Error message

Tasks file not found at ${tasksPath}

What it means

validateDependenciesDirect checks fs.existsSync(tasksPath) before reading the file; when the given path does not exist it returns FILE_NOT_FOUND with the path embedded in the message instead of throwing an ENOENT stack trace.

Source

Thrown at mcp-server/src/core/direct-functions/validate-dependencies.js:48

				code: 'MISSING_ARGUMENT',
				message: 'tasksJsonPath is required'
			}
		};
	}

	try {
		log.info(`Validating dependencies in tasks: ${tasksJsonPath}`);

		// Use the provided tasksJsonPath
		const tasksPath = tasksJsonPath;

		// Verify the file exists
		if (!fs.existsSync(tasksPath)) {
			return {
				success: false,
				error: {
					code: 'FILE_NOT_FOUND',
					message: `Tasks file not found at ${tasksPath}`
				}
			};
		}

		// Enable silent mode to prevent console logs from interfering with JSON response
		enableSilentMode();

		const options = { projectRoot, tag };
		// Call the original command function using the provided tasksPath
		await validateDependenciesCommand(tasksPath, options);

		// Restore normal logging
		disableSilentMode();

		return {
			success: true,
			data: {
				message: 'Dependencies validated successfully',

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run task-master init (or create .taskmaster/tasks.json) in the project
  2. Pass an absolute path to tasks.json instead of a relative one
  3. Verify the path exists (fs.existsSync) in the caller before invoking the tool

Example fix

// before
await validateDependenciesDirect({ tasksJsonPath: 'tasks.json' });
// after
const tasksPath = path.resolve(process.cwd(), '.taskmaster/tasks.json');
if (!fs.existsSync(tasksPath)) throw new Error(`tasks.json missing at ${tasksPath}`);
await validateDependenciesDirect({ tasksJsonPath: tasksPath });
Defensive patterns

Strategy: validation

Validate before calling

const tasksPath = path.resolve(projectRoot, '.taskmaster/tasks.json');
if (!fs.existsSync(tasksPath)) {
  throw new Error(`tasks.json not found at ${tasksPath}. Run 'task-master init' first.`);
}

Type guard

function tasksFileExists(p: unknown): p is string {
  return typeof p === 'string' && fs.existsSync(p) && fs.statSync(p).isFile();
}

Try / catch

const res = await validateDependenciesDirect({ tasksJsonPath });
if (!res.success && res.error?.code === 'FILE_NOT_FOUND') {
  // initialize project or correct the path before retrying
}

Prevention

When it happens

Trigger: tasksJsonPath points to a file that does not exist — wrong workspace root, project not initialized (no .taskmaster/tasks.json yet), or a typo'd/relative path resolved against a different cwd.

Common situations: Running the MCP server from a different directory than the project; task master never initialized (no `task-master init`); file moved or renamed; tests passing a temp path that was cleaned up.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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