eyaltoledano/claude-task-master · error
MISSING_ARGUMENT
MISSING_ARGUMENT
Error message
tasksJsonPath is required
What it means
addDependencyDirect is the MCP direct-function wrapper around the add-dependency core function. It requires the resolved filesystem path to the tasks.json file (tasksJsonPath) to operate. When the argument is missing or empty it returns a structured failure object (not a thrown exception) with code MISSING_ARGUMENT, after logging the misuse.
Source
Thrown at mcp-server/src/core/direct-functions/add-dependency.js:36
* @param {string|number} args.dependsOn - Task ID that will become a dependency
* @param {string} args.tag - Tag for the task (optional)
* @param {string} args.projectRoot - Project root path (for MCP/env fallback)
* @param {Object} log - Logger object
* @returns {Promise<Object>} - Result object with success status and data/error information
*/
export async function addDependencyDirect(args, log) {
// Destructure expected args
const { tasksJsonPath, id, dependsOn, tag, projectRoot } = args;
try {
log.info(`Adding dependency with args: ${JSON.stringify(args)}`);
// Check if tasksJsonPath was provided
if (!tasksJsonPath) {
log.error('addDependencyDirect called without tasksJsonPath');
return {
success: false,
error: {
code: 'MISSING_ARGUMENT',
message: 'tasksJsonPath is required'
}
};
}
// Validate required parameters
if (!id) {
return {
success: false,
error: {
code: 'INPUT_VALIDATION_ERROR',
message: 'Task ID (id) is required'
}
};
}
if (!dependsOn) {
return {View on GitHub (pinned to c0c98d367c)
Solutions
- Pass an absolute or project-relative tasksJsonPath argument pointing at your tasks.json file.
- Run the call from (or configure the MCP server with) the project directory that contains tasks.json.
- Check the tool's input schema in your MCP client so the parameter is required and populated.
- Verify the resolved path variable upstream isn't undefined due to a failed path-resolution helper.
Example fix
// before
await addDependencyDirect({ id: '3', dependsOn: '1' });
// after
await addDependencyDirect({
id: '3',
dependsOn: '1',
tasksJsonPath: '/path/to/project/tasks.json'
}); 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');
}
if (!fs.existsSync(args.tasksJsonPath)) {
throw new Error(`tasksJsonPath does not exist: ${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
- Always launch the MCP server from (or configure it with) the project root containing tasks.json.
- Mark tasksJsonPath as required in your client-side tool argument construction.
- Resolve and normalize the path once at startup, then reuse it.
- Check file existence with fs.existsSync before invoking the tool.
When it happens
Trigger: Calling the add_dependency MCP tool without passing tasksJsonPath in the tool arguments; the MCP client/config omitting the project-root-to-tasks.json mapping so the resolver yields undefined; passing an empty string path.
Common situations: MCP tool invocations from AI clients that drop optional-looking parameters; multi-project setups where the tool is called outside a directory containing tasks.json and no explicit path is supplied; renamed or moved tasks.json without updating the wrapper's path resolution.
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/1aba5dbe797a60db.
Report an issue: GitHub.