{"record":{"id":"1aba5dbe797a60db","repo":"eyaltoledano/claude-task-master","slug":"missing-argument","errorCode":"MISSING_ARGUMENT","errorMessage":"tasksJsonPath is required","messagePattern":"tasksJsonPath is required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/add-dependency.js","lineNumber":36,"sourceCode":" * @param {string|number} args.dependsOn - Task ID that will become a dependency\n * @param {string} args.tag - Tag for the task (optional)\n * @param {string} args.projectRoot - Project root path (for MCP/env fallback)\n * @param {Object} log - Logger object\n * @returns {Promise<Object>} - Result object with success status and data/error information\n */\nexport async function addDependencyDirect(args, log) {\n\t// Destructure expected args\n\tconst { tasksJsonPath, id, dependsOn, tag, projectRoot } = args;\n\ttry {\n\t\tlog.info(`Adding dependency with args: ${JSON.stringify(args)}`);\n\n\t\t// Check if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('addDependencyDirect called without tasksJsonPath');\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'MISSING_ARGUMENT',\n\t\t\t\t\tmessage: 'tasksJsonPath is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Validate required parameters\n\t\tif (!id) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'INPUT_VALIDATION_ERROR',\n\t\t\t\t\tmessage: 'Task ID (id) is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tif (!dependsOn) {\n\t\t\treturn {","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/add-dependency.js#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait addDependencyDirect({ id: '3', dependsOn: '1' });\n// after\nawait addDependencyDirect({\n  id: '3',\n  dependsOn: '1',\n  tasksJsonPath: '/path/to/project/tasks.json'\n});","handlingStrategy":"validation","validationCode":"function assertTasksJsonPath(args) {\n  if (!args || typeof args.tasksJsonPath !== 'string' || args.tasksJsonPath.trim() === '') {\n    throw new Error('tasksJsonPath is required');\n  }\n  if (!fs.existsSync(args.tasksJsonPath)) {\n    throw new Error(`tasksJsonPath does not exist: ${args.tasksJsonPath}`);\n  }\n}","typeGuard":"function hasTasksJsonPath(args) {\n  return typeof args?.tasksJsonPath === 'string' && args.tasksJsonPath.length > 0;\n}","tryCatchPattern":"if (!hasTasksJsonPath(args)) {\n  return { success: false, error: { code: 'MISSING_ARGUMENT', message: 'tasksJsonPath is required' } };\n}","preventionTips":["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."],"tags":["validation","mcp","missing-argument","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}