eyaltoledano/claude-task-master · error

MISSING_ARGUMENT

MISSING_ARGUMENT

Error message

tasksJsonPath is required

What it means

removeTaskDirect, the direct-function wrapper for removing tasks, requires an explicit `tasksJsonPath` argument. If it is missing or falsy it returns MISSING_ARGUMENT before any file access, ensuring the tool never removes tasks from an ambiguously resolved tasks file.

Source

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

 * @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.
 * @param {string} args.id - The ID(s) of the task(s) or subtask(s) to remove (comma-separated for multiple).
 * @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>} - Remove task result { success: boolean, data?: any, error?: { code: string, message: string } }
 */
export async function removeTaskDirect(args, log, context = {}) {
	// Destructure expected args
	const { tasksJsonPath, id, projectRoot, tag } = args;
	const { session } = context;
	try {
		// Check if tasksJsonPath was provided
		if (!tasksJsonPath) {
			log.error('removeTaskDirect called without tasksJsonPath');
			return {
				success: false,
				error: {
					code: 'MISSING_ARGUMENT',
					message: 'tasksJsonPath is required'
				}
			};
		}

		// Validate task ID parameter
		if (!id) {
			log.error('Task ID is required');
			return {
				success: false,
				error: {
					code: 'INPUT_VALIDATION_ERROR',
					message: 'Task ID is required'
				}
			};
		}

		// Split task IDs if comma-separated

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the absolute path to tasks.json as `tasksJsonPath` in the args (e.g. .taskmaster/tasks.json).
  2. Ensure `projectRoot` is supplied so upstream layers can resolve tasksJsonPath automatically.
  3. Inspect the MCP client config/tool schema to confirm the argument is being sent, not stripped.
  4. Update both MCP client and server to matching versions if a previously working call stopped including the path.

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

const result = await removeTaskDirect(args, log);
if (!result.success && result.error?.code === 'MISSING_ARGUMENT') {
  // args.tasksJsonPath missing — resolve from projectRoot and retry
}
const result2 = await removeTaskDirect({ ...args, tasksJsonPath: resolvedPath }, log);

Prevention

When it happens

Trigger: Calling the remove_task MCP tool without `tasksJsonPath`; passing an empty string; an MCP client/server version mismatch where the server no longer infers the path from projectRoot/session.

Common situations: Clients configured without projectRoot so the path was never derived; old integrations relying on implicit path resolution; hand-written tool calls omitting the argument.

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