{"record":{"id":"d3fc894c841454c8","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-d3fc89","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/remove-subtask.js","lineNumber":39,"sourceCode":" * @returns {Promise<{success: boolean, data?: Object, error?: {code: string, message: string}}>}\n */\nexport async function removeSubtaskDirect(args, log) {\n\t// Destructure expected args\n\tconst { tasksJsonPath, id, convert, skipGenerate, projectRoot, tag } = args;\n\ttry {\n\t\t// Enable silent mode to prevent console logs from interfering with JSON response\n\t\tenableSilentMode();\n\n\t\tlog.info(`Removing subtask with args: ${JSON.stringify(args)}`);\n\n\t\t// Check if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('removeSubtaskDirect called without tasksJsonPath');\n\t\t\tdisableSilentMode(); // Disable before returning\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\tdisableSilentMode(); // Disable before returning\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:\n\t\t\t\t\t\t'Subtask ID is required and must be in format \"parentId.subtaskId\"'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Validate subtask ID format","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/remove-subtask.js#L21-L57","documentation":"removeSubtaskDirect in the MCP server requires an explicit `tasksJsonPath` argument pointing at the project's tasks.json. When the argument is missing, empty, or falsy, the wrapper short-circuits before touching the core task manager and returns a structured failure with code MISSING_ARGUMENT. It exists to guarantee the MCP layer never guesses which tasks file to mutate.","triggerScenarios":"Calling the remove_subtask MCP tool (or removeSubtaskDirect directly) without `tasksJsonPath` in the args object, passing an empty string, or the tool client dropping the argument during serialization.","commonSituations":"MCP client tool schemas that don't pass projectRoot-derived paths; callers migrating from older tool versions where the path was resolved from the session; hand-rolled tool invocations that omit the argument entirely.","solutions":["Pass the absolute path to tasks.json as `tasksJsonPath` in the tool call args (e.g. the project's .taskmaster/tasks.json).","If using projectRoot-based resolution, ensure `projectRoot` is passed so the server layer can compute tasksJsonPath before calling the direct function.","Verify the MCP client is sending the full args object (check tool schema in the client config) and no argument-stripping middleware is dropping it.","Check for version mismatches: older clients may not send tasksJsonPath; update client and server to matching versions."],"exampleFix":"// before\nawait removeSubtaskDirect({ id: '1.2', log });\n// after\nawait removeSubtaskDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json', id: '1.2', log });","handlingStrategy":"validation","validationCode":"function assertTasksJsonPath(args) {\n  if (!args || typeof args.tasksJsonPath !== 'string' || args.tasksJsonPath.trim() === '') {\n    throw new Error('tasksJsonPath is required: pass the absolute path to your tasks.json');\n  }\n  return args.tasksJsonPath;\n}","typeGuard":"function hasTasksJsonPath(args) {\n  return typeof args === 'object' && args !== null &&\n    typeof args.tasksJsonPath === 'string' && args.tasksJsonPath.length > 0;\n}","tryCatchPattern":"try {\n  const result = await removeSubtaskDirect(args, log);\n  if (!result.success && result.error?.code === 'MISSING_ARGUMENT') {\n    // supply tasksJsonPath and retry or surface a clear message\n  }\n} catch (err) { /* unexpected transport failure */ }","preventionTips":["Always resolve tasksJsonPath from projectRoot at startup and reuse it for every tool call.","Validate required args with a shared pre-call assertion helper before invoking any direct function.","Pin MCP client and server versions so tool schemas agree on required arguments.","Include tasksJsonPath in your tool-call builder's required-fields list."],"tags":["mcp","validation","missing-argument","tasks-json"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}