eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

tasksJsonPath is required

What it means

removeSubtaskDirect in the MCP server requires an explicit `tasksJsonPath` argument pointing at the project's tasks.json. When the argument is missing, empty, or falsy, the wrapper short-circuits before touching the core task manager and returns a structured failure with code MISSING_ARGUMENT. It exists to guarantee the MCP layer never guesses which tasks file to mutate.

Source

Thrown at mcp-server/src/core/direct-functions/remove-subtask.js:39

 * @returns {Promise<{success: boolean, data?: Object, error?: {code: string, message: string}}>}
 */
export async function removeSubtaskDirect(args, log) {
	// Destructure expected args
	const { tasksJsonPath, id, convert, skipGenerate, projectRoot, tag } = args;
	try {
		// Enable silent mode to prevent console logs from interfering with JSON response
		enableSilentMode();

		log.info(`Removing subtask with args: ${JSON.stringify(args)}`);

		// Check if tasksJsonPath was provided
		if (!tasksJsonPath) {
			log.error('removeSubtaskDirect called without tasksJsonPath');
			disableSilentMode(); // Disable before returning
			return {
				success: false,
				error: {
					code: 'MISSING_ARGUMENT',
					message: 'tasksJsonPath is required'
				}
			};
		}

		if (!id) {
			disableSilentMode(); // Disable before returning
			return {
				success: false,
				error: {
					code: 'INPUT_VALIDATION_ERROR',
					message:
						'Subtask ID is required and must be in format "parentId.subtaskId"'
				}
			};
		}

		// Validate subtask ID format

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the absolute path to tasks.json as `tasksJsonPath` in the tool call args (e.g. the project's .taskmaster/tasks.json).
  2. If using projectRoot-based resolution, ensure `projectRoot` is passed so the server layer can compute tasksJsonPath before calling the direct function.
  3. Verify the MCP client is sending the full args object (check tool schema in the client config) and no argument-stripping middleware is dropping it.
  4. Check for version mismatches: older clients may not send tasksJsonPath; update client and server to matching versions.

Example fix

// before
await removeSubtaskDirect({ id: '1.2', log });
// after
await removeSubtaskDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json', id: '1.2', log });
Defensive patterns

Strategy: validation

Validate before calling

function assertTasksJsonPath(args) {
  if (!args || typeof args.tasksJsonPath !== 'string' || args.tasksJsonPath.trim() === '') {
    throw new Error('tasksJsonPath is required: pass the absolute path to your tasks.json');
  }
  return args.tasksJsonPath;
}

Type guard

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

Try / catch

try {
  const result = await removeSubtaskDirect(args, log);
  if (!result.success && result.error?.code === 'MISSING_ARGUMENT') {
    // supply tasksJsonPath and retry or surface a clear message
  }
} catch (err) { /* unexpected transport failure */ }

Prevention

When it happens

Trigger: Calling the remove_subtask MCP tool (or removeSubtaskDirect directly) without `tasksJsonPath` in the args object, passing an empty string, or the tool client dropping the argument during serialization.

Common situations: MCP client tool schemas that don't pass projectRoot-derived paths; callers migrating from older tool versions where the path was resolved from the session; hand-rolled tool invocations that omit the argument entirely.

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