{"record":{"id":"e944d8056844fc6b","repo":"eyaltoledano/claude-task-master","slug":"missing-argument-e944d8","errorCode":"MISSING_ARGUMENT","errorMessage":"tasksJsonPath is required","messagePattern":"tasksJsonPath is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/expand-task.js","lineNumber":66,"sourceCode":"\t} = args;\n\n\t// Log session root data for debugging\n\tlog.info(\n\t\t`Session data in expandTaskDirect: ${JSON.stringify({\n\t\t\thasSession: !!session,\n\t\t\tsessionKeys: session ? Object.keys(session) : [],\n\t\t\troots: session?.roots,\n\t\t\trootsStr: JSON.stringify(session?.roots)\n\t\t})}`\n\t);\n\n\t// Check if tasksJsonPath was provided\n\tif (!tasksJsonPath) {\n\t\tlog.error('expandTaskDirect 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// Use provided path\n\tconst tasksPath = tasksJsonPath;\n\n\tlog.info(`[expandTaskDirect] Using tasksPath: ${tasksPath}`);\n\n\t// Validate task ID\n\tconst taskId = id ? parseInt(id, 10) : null;\n\tif (!taskId) {\n\t\tlog.error('Task ID is required');\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'INPUT_VALIDATION_ERROR',","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/expand-task.js#L48-L84","documentation":"expandTaskDirect requires tasksJsonPath to load the tasks file for the task being expanded. A missing/empty argument fails fast with this MISSING_ARGUMENT structured error before any file access.","triggerScenarios":"Calling the expand_task MCP tool without tasksJsonPath; custom MCP server wiring not resolving the path from projectRoot; direct invocation from scripts/tests omitting the field.","commonSituations":"Server launched with wrong cwd so path inference returns undefined; arguments built by template missing the field; users following outdated tool-call examples.","solutions":["Supply tasksJsonPath explicitly, e.g. '/repo/.taskmaster/tasks.json'.","Launch the MCP server with the correct project root so the path resolves automatically.","Confirm the tasks file exists and pass its absolute path.","Inspect the exact arguments dict at the call site for a dropped/misspelled key."],"exampleFix":"// before\nawait expandTaskDirect({ id: '3' });\n// after\nawait expandTaskDirect({ tasksJsonPath: '/repo/.taskmaster/tasks.json', id: '3' });","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction assertExpandArgs(args) {\n  if (!args.tasksJsonPath || !fs.existsSync(args.tasksJsonPath)) {\n    throw new Error('expand_task requires an existing tasksJsonPath');\n  }\n  if (!args.id || Number.isNaN(parseInt(args.id, 10))) {\n    throw new Error('expand_task requires a numeric task id');\n  }\n}","typeGuard":"function isExpandTaskInput(a) {\n  return typeof a.tasksJsonPath === 'string' && a.tasksJsonPath.length > 0;\n}","tryCatchPattern":"const res = await expandTaskDirect(args);\nif (!res.success && res.error?.code === 'MISSING_ARGUMENT') {\n  // recover by resolving the default path and retrying once\n  res2 = await expandTaskDirect({ ...args, tasksJsonPath: defaultTasksPath });\n}","preventionTips":["Pass tasksJsonPath on every expand_task call; don't rely on inference.","Standardize a single path resolver for all direct-function wrappers.","Check server cwd/env at startup; fail fast if the tasks file can't be located.","Log full arguments at the call site to catch silently dropped fields."],"tags":["mcp-server","missing-argument","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}