eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

tasksJsonPath is required

What it means

nextTaskDirect (mcp-server/src/core/direct-functions/next-task.js:32-41) validates that the `tasksJsonPath` argument is present before doing any work. This MCP tool wrapper needs an explicit path to a tasks.json file to look up the next actionable task. Without it the function immediately returns a structured MISSING_ARGUMENT error instead of attempting a filesystem read.

Source

Thrown at mcp-server/src/core/direct-functions/next-task.js:37

 * @param {Object} args - Command arguments
 * @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.
 * @param {string} args.reportPath - Path to the report file.
 * @param {string} args.projectRoot - Project root path (for MCP/env fallback)
 * @param {string} args.tag - Tag for the task (optional)
 * @param {Object} log - Logger object
 * @returns {Promise<Object>} - Next task result { success: boolean, data?: any, error?: { code: string, message: string } }
 */
export async function nextTaskDirect(args, log, context = {}) {
	// Destructure expected args
	const { tasksJsonPath, reportPath, projectRoot, tag } = args;
	const { session } = context;

	if (!tasksJsonPath) {
		log.error('nextTaskDirect called without tasksJsonPath');
		return {
			success: false,
			error: {
				code: 'MISSING_ARGUMENT',
				message: 'tasksJsonPath is required'
			}
		};
	}

	// Define the action function to be executed on cache miss
	const coreNextTaskAction = async () => {
		try {
			// Enable silent mode to prevent console logs from interfering with JSON response
			enableSilentMode();

			log.info(`Finding next task from ${tasksJsonPath}`);

			// Read tasks data using the provided path
			const data = readJSON(tasksJsonPath, projectRoot, tag);
			if (!data || !data.tasks) {
				disableSilentMode(); // Disable before return
				return {

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the absolute path to your .taskmaster/tasks/tasks.json (or tag-specific tasks.json) as the `tasksJsonPath` argument.
  2. If you only know projectRoot, resolve the path first (e.g. path.join(projectRoot, '.taskmaster', 'tasks', 'tasks.json')) or go through the higher-level tool handler that computes it.
  3. Check the tool call arguments for typos like `taskJsonPath` or `tasksPath` — the exact key is `tasksJsonPath`.

Example fix

// before
await nextTaskDirect({ projectRoot: '/my/project' }, log);

// after
await nextTaskDirect(
  { projectRoot: '/my/project', tasksJsonPath: '/my/project/.taskmaster/tasks/tasks.json' },
  log
);
Defensive patterns

Strategy: validation

Validate before calling

if (!args?.tasksJsonPath) throw new Error('tasksJsonPath is required: pass the absolute path to your tasks.json');

Type guard

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

Prevention

When it happens

Trigger: Calling the MCP `next_task` tool (which invokes nextTaskDirect) without passing `tasksJsonPath` in the args object, or passing it as an empty string / undefined because the MCP server tool schema allowed the parameter to be omitted.

Common situations: Developers invoking the tool directly (scripts, AI agent tool calls) that omit required arguments; custom MCP clients that don't populate the resolved tasks.json path; environments where the tool layer usually derives the path but the caller bypassed that layer and called the direct function raw.

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