{"record":{"id":"af8f091d865d11cc","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-af8f09","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/next-task.js","lineNumber":37,"sourceCode":" * @param {Object} args - Command arguments\n * @param {string} args.tasksJsonPath - Explicit path to the tasks.json file.\n * @param {string} args.reportPath - Path to the report file.\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>} - Next task result { success: boolean, data?: any, error?: { code: string, message: string } }\n */\nexport async function nextTaskDirect(args, log, context = {}) {\n\t// Destructure expected args\n\tconst { tasksJsonPath, reportPath, projectRoot, tag } = args;\n\tconst { session } = context;\n\n\tif (!tasksJsonPath) {\n\t\tlog.error('nextTaskDirect called without tasksJsonPath');\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'MISSING_ARGUMENT',\n\t\t\t\tmessage: 'tasksJsonPath is required'\n\t\t\t}\n\t\t};\n\t}\n\n\t// Define the action function to be executed on cache miss\n\tconst coreNextTaskAction = async () => {\n\t\ttry {\n\t\t\t// Enable silent mode to prevent console logs from interfering with JSON response\n\t\t\tenableSilentMode();\n\n\t\t\tlog.info(`Finding next task from ${tasksJsonPath}`);\n\n\t\t\t// Read tasks data using the provided path\n\t\t\tconst data = readJSON(tasksJsonPath, projectRoot, tag);\n\t\t\tif (!data || !data.tasks) {\n\t\t\t\tdisableSilentMode(); // Disable before return\n\t\t\t\treturn {","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/next-task.js#L19-L55","documentation":"nextTaskDirect (mcp-server/src/core/direct-functions/next-task.js:32-41) validates that the `tasksJsonPath` argument is present before doing any work. This MCP tool wrapper needs an explicit path to a tasks.json file to look up the next actionable task. Without it the function immediately returns a structured MISSING_ARGUMENT error instead of attempting a filesystem read.","triggerScenarios":"Calling the MCP `next_task` tool (which invokes nextTaskDirect) without passing `tasksJsonPath` in the args object, or passing it as an empty string / undefined because the MCP server tool schema allowed the parameter to be omitted.","commonSituations":"Developers invoking the tool directly (scripts, AI agent tool calls) that omit required arguments; custom MCP clients that don't populate the resolved tasks.json path; environments where the tool layer usually derives the path but the caller bypassed that layer and called the direct function raw.","solutions":["Pass the absolute path to your .taskmaster/tasks/tasks.json (or tag-specific tasks.json) as the `tasksJsonPath` argument.","If you only know projectRoot, resolve the path first (e.g. path.join(projectRoot, '.taskmaster', 'tasks', 'tasks.json')) or go through the higher-level tool handler that computes it.","Check the tool call arguments for typos like `taskJsonPath` or `tasksPath` — the exact key is `tasksJsonPath`."],"exampleFix":"// before\nawait nextTaskDirect({ projectRoot: '/my/project' }, log);\n\n// after\nawait nextTaskDirect(\n  { projectRoot: '/my/project', tasksJsonPath: '/my/project/.taskmaster/tasks/tasks.json' },\n  log\n);","handlingStrategy":"validation","validationCode":"if (!args?.tasksJsonPath) throw new Error('tasksJsonPath is required: pass the absolute path to your tasks.json');","typeGuard":"function hasTasksJsonPath(args) {\n  return typeof args === 'object' && args !== null && typeof args.tasksJsonPath === 'string' && args.tasksJsonPath.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always pass an absolute tasks.json path when calling nextTaskDirect directly.","Build the path from projectRoot with path.join so it is never empty.","Call the higher-level MCP tool handler that derives the path for you when possible."],"tags":["mcp","missing-argument","input-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}