eyaltoledano/claude-task-master · error
MISSING_ARGUMENT
MISSING_ARGUMENT
Error message
tasksJsonPath is required
What it means
addSubtaskDirect, the MCP direct-function wrapper for add-subtask, requires tasksJsonPath to locate the task file it will mutate. If missing or empty, it returns a structured MISSING_ARGUMENT failure and logs the misuse, mirroring the validation pattern of addDependencyDirect.
Source
Thrown at mcp-server/src/core/direct-functions/add-subtask.js:52
title,
description,
details,
status,
dependencies: dependenciesStr,
skipGenerate,
projectRoot,
tag
} = args;
try {
log.info(`Adding subtask with args: ${JSON.stringify(args)}`);
// Check if tasksJsonPath was provided
if (!tasksJsonPath) {
log.error('addSubtaskDirect called without tasksJsonPath');
return {
success: false,
error: {
code: 'MISSING_ARGUMENT',
message: 'tasksJsonPath is required'
}
};
}
if (!id) {
return {
success: false,
error: {
code: 'INPUT_VALIDATION_ERROR',
message: 'Parent task ID is required'
}
};
}
// Either taskId or title must be provided
if (!taskId && !title) {
return {View on GitHub (pinned to c0c98d367c)
Solutions
- Pass tasksJsonPath pointing to the project's tasks.json file.
- Start/configure the MCP server in the directory containing tasks.json so defaults resolve.
- Make the client send all required arguments per the add_subtask tool schema.
- Check for empty-string paths produced by template placeholders that were never filled in.
Example fix
// before
await addSubtaskDirect({ id: '1', title: 'Write tests' });
// after
await addSubtaskDirect({
tasksJsonPath: '/path/to/project/tasks.json',
id: '1',
title: 'Write tests'
}); Defensive patterns
Strategy: validation
Validate before calling
function assertAddSubtaskPath(args) {
if (typeof args?.tasksJsonPath !== 'string' || args.tasksJsonPath.trim() === '') {
throw new Error('tasksJsonPath is required');
}
if (!fs.existsSync(args.tasksJsonPath)) {
throw new Error(`tasks.json not found at: ${args.tasksJsonPath}`);
}
} Type guard
function hasTasksJsonPath(args) {
return typeof args?.tasksJsonPath === 'string' && args.tasksJsonPath.length > 0;
} Try / catch
if (!hasTasksJsonPath(args)) {
return { success: false, error: { code: 'MISSING_ARGUMENT', message: 'tasksJsonPath is required' } };
} Prevention
- Pass tasksJsonPath explicitly in every add_subtask call, even when the server has a default.
- Store the path in a single config constant to avoid drift across calls.
- Verify existence with fs.existsSync before invocation.
- Re-check the path after workspace renames or monorepo restructuring.
When it happens
Trigger: Calling the add_subtask MCP tool without a tasksJsonPath argument; the MCP session's path resolution returns undefined because the tool is invoked outside a project directory; an empty-string path passed by a generated client.
Common situations: AI clients invoking add_subtask with only the subtask fields and forgetting the file path; monorepo setups where tasks.json lives in a subdirectory not covered by default resolution; renamed workspace roots after a refactor.
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
- MISSING_ARGUMENT
- INPUT_VALIDATION_ERROR
- INPUT_VALIDATION_ERROR
- MISSING_ARGUMENT
- INVALID_TARGET_DIRECTORY
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/31de4b99dc0e64bc.
Report an issue: GitHub.