{"record":{"id":"f0099719fa817649","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-f00997","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-task.js","lineNumber":39,"sourceCode":" * @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.\n * @param {string} args.id - The ID(s) of the task(s) or subtask(s) to remove (comma-separated for multiple).\n * @param {string} args.projectRoot - Project root path (for MCP/env fallback)\n * @param {string} args.tag - Tag for the task (optional)\n * @param {Object} log - Logger object\n * @returns {Promise<Object>} - Remove task result { success: boolean, data?: any, error?: { code: string, message: string } }\n */\nexport async function removeTaskDirect(args, log, context = {}) {\n\t// Destructure expected args\n\tconst { tasksJsonPath, id, projectRoot, tag } = args;\n\tconst { session } = context;\n\ttry {\n\t\t// Check if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('removeTaskDirect 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 task ID parameter\n\t\tif (!id) {\n\t\t\tlog.error('Task ID is required');\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 is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Split task IDs if comma-separated","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/remove-task.js#L21-L57","documentation":"removeTaskDirect, the direct-function wrapper for removing tasks, requires an explicit `tasksJsonPath` argument. If it is missing or falsy it returns MISSING_ARGUMENT before any file access, ensuring the tool never removes tasks from an ambiguously resolved tasks file.","triggerScenarios":"Calling the remove_task MCP tool without `tasksJsonPath`; passing an empty string; an MCP client/server version mismatch where the server no longer infers the path from projectRoot/session.","commonSituations":"Clients configured without projectRoot so the path was never derived; old integrations relying on implicit path resolution; hand-written tool calls omitting the argument.","solutions":["Pass the absolute path to tasks.json as `tasksJsonPath` in the args (e.g. .taskmaster/tasks.json).","Ensure `projectRoot` is supplied so upstream layers can resolve tasksJsonPath automatically.","Inspect the MCP client config/tool schema to confirm the argument is being sent, not stripped.","Update both MCP client and server to matching versions if a previously working call stopped including the path."],"exampleFix":"// before\nawait removeTaskDirect({ id: '12', log });\n// after\nawait removeTaskDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json', id: '12', log });","handlingStrategy":"validation","validationCode":"function assertRemoveTaskArgs(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  if (typeof args.id !== 'string' || args.id.trim() === '') {\n    throw new Error('id is required (comma-separated ids allowed)');\n  }\n  return args;\n}","typeGuard":"function hasRemoveTaskArgs(args) {\n  return typeof args === 'object' && args !== null &&\n    typeof args.tasksJsonPath === 'string' && args.tasksJsonPath.length > 0 &&\n    typeof args.id === 'string' && args.id.length > 0;\n}","tryCatchPattern":"const result = await removeTaskDirect(args, log);\nif (!result.success && result.error?.code === 'MISSING_ARGUMENT') {\n  // args.tasksJsonPath missing — resolve from projectRoot and retry\n}\nconst result2 = await removeTaskDirect({ ...args, tasksJsonPath: resolvedPath }, log);","preventionTips":["Resolve tasks.json from projectRoot once per session and inject it into every tool call.","Validate required args centrally before any direct-function invocation.","Keep MCP client and server tool schemas in sync (same version).","Fail fast in your own tool wrapper when tasksJsonPath is absent, with an actionable message."],"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"}