{"record":{"id":"31de4b99dc0e64bc","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-31de4b","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-subtask.js","lineNumber":52,"sourceCode":"\t\ttitle,\n\t\tdescription,\n\t\tdetails,\n\t\tstatus,\n\t\tdependencies: dependenciesStr,\n\t\tskipGenerate,\n\t\tprojectRoot,\n\t\ttag\n\t} = args;\n\ttry {\n\t\tlog.info(`Adding subtask with args: ${JSON.stringify(args)}`);\n\n\t\t// Check if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('addSubtaskDirect 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\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: 'Parent task ID is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Either taskId or title must be provided\n\t\tif (!taskId && !title) {\n\t\t\treturn {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/add-subtask.js#L34-L70","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nawait addSubtaskDirect({ id: '1', title: 'Write tests' });\n// after\nawait addSubtaskDirect({\n  tasksJsonPath: '/path/to/project/tasks.json',\n  id: '1',\n  title: 'Write tests'\n});","handlingStrategy":"validation","validationCode":"function assertAddSubtaskPath(args) {\n  if (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(`tasks.json not found at: ${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":["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."],"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"}