eyaltoledano/claude-task-master · error
INPUT_VALIDATION_ERROR
INPUT_VALIDATION_ERROR
Error message
Parent task ID is required
What it means
addSubtaskDirect validates that id — the parent task under which the subtask will be added — is provided. A missing id returns a structured INPUT_VALIDATION_ERROR result. Without a parent task the core function cannot decide where to insert the new subtask.
Source
Thrown at mcp-server/src/core/direct-functions/add-subtask.js:62
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 {
success: false,
error: {
code: 'INPUT_VALIDATION_ERROR',
message: 'Either taskId or title must be provided'
}
};
}
// Use provided path
const tasksPath = tasksJsonPath;View on GitHub (pinned to c0c98d367c)
Solutions
- Include id with the parent task's ID (e.g. '1' or 'HAM-12').
- Match argument names exactly to the tool schema (id, not parentId or parent).
- Ensure the parent task exists in tasks.json before adding the subtask.
- If you meant to convert an existing task into a subtask, pass id (parent) plus taskId (the existing task).
Example fix
// before
await addSubtaskDirect({ tasksJsonPath, title: 'Write tests' });
// after
await addSubtaskDirect({ tasksJsonPath, id: '1', title: 'Write tests' }); Defensive patterns
Strategy: validation
Validate before calling
function assertParentId(args) {
const id = args?.id;
if (typeof id !== 'string' || id.trim() === '') {
throw new Error('Parent task ID (id) is required');
}
const data = JSON.parse(fs.readFileSync(args.tasksJsonPath, 'utf8'));
if (!data.tasks?.some(t => String(t.id) === id)) {
throw new Error(`Parent task ${id} not found in tasks.json`);
}
} Type guard
function hasParentId(args) {
return typeof args?.id === 'string' && args.id.trim().length > 0;
} Try / catch
if (!hasParentId(args)) {
return { success: false, error: { code: 'INPUT_VALIDATION_ERROR', message: 'Parent task ID is required' } };
} Prevention
- Distinguish clearly: id = parent task, taskId = existing task to convert, title = new subtask name.
- Confirm the parent exists before adding subtasks to it.
- Keep argument names aligned with the tool schema (id, not parentId).
- Centralize tool-call construction in one typed helper.
When it happens
Trigger: Calling add_subtask with only title/taskId (creating a subtask payload) but omitting the parent id; a client sending parentId instead of id; generated tool calls dropping the first positional-style argument.
Common situations: Confusion between the parent id and the optional existing taskId (task to convert into a subtask); LLM tool calls that omit arguments they consider inferable; migrating scripts from a CLI flag spelling (--parent) to the MCP argument spelling.
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/8df0203b023b9c0d.
Report an issue: GitHub.