{"record":{"id":"75b6d6eec11969b2","repo":"eyaltoledano/claude-task-master","slug":"input-validation-error","errorCode":"INPUT_VALIDATION_ERROR","errorMessage":"Task ID (id) is required","messagePattern":"Task ID \\(id\\) is required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/add-dependency.js","lineNumber":47,"sourceCode":"\n\t\t// Check if tasksJsonPath was provided\n\t\tif (!tasksJsonPath) {\n\t\t\tlog.error('addDependencyDirect 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 required parameters\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: 'Task ID (id) is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tif (!dependsOn) {\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: 'Dependency ID (dependsOn) is required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Use provided path\n\t\tconst tasksPath = tasksJsonPath;\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/add-dependency.js#L29-L65","documentation":"After confirming tasksJsonPath exists, addDependencyDirect validates that the id parameter — the task that will receive the new dependency — is present. Missing id yields a structured INPUT_VALIDATION_ERROR result rather than a thrown error. This prevents the core function from attempting dependency resolution against an undefined task identifier.","triggerScenarios":"Invoking the add_dependency tool with tasksJsonPath and dependsOn but omitting id; a client mapping argument names incorrectly (e.g. sending taskId instead of id) so id is undefined.","commonSituations":"LLM-generated tool calls that guess parameter names; hand-written MCP client code that predates a parameter rename; batch scripts building arguments dynamically where the id key is mistyped.","solutions":["Include the id argument with the ID of the task that should depend on another.","Check parameter naming — the tool expects exactly id, not taskId or task_id.","Confirm the value is non-empty (e.g. '3' or 'HAM-123'), not an empty string.","Consult the add_dependency tool schema exposed by the MCP server for the correct argument list."],"exampleFix":"// before\nawait addDependencyDirect({ tasksJsonPath, dependsOn: '1' });\n// after\nawait addDependencyDirect({ tasksJsonPath, id: '3', dependsOn: '1' });","handlingStrategy":"validation","validationCode":"function assertTaskId(args) {\n  const id = args?.id;\n  if (typeof id !== 'string' || id.trim() === '') {\n    throw new Error('Task ID (id) is required');\n  }\n}","typeGuard":"function hasTaskId(args) {\n  return typeof args?.id === 'string' && args.id.trim().length > 0;\n}","tryCatchPattern":"if (!hasTaskId(args)) {\n  return { success: false, error: { code: 'INPUT_VALIDATION_ERROR', message: 'Task ID (id) is required' } };\n}","preventionTips":["Use the exact argument name id (not taskId/task_id) per the tool schema.","Validate argument objects against the tool's input schema before dispatch.","When generating calls with an LLM, include the schema in the prompt so parameter names are honored.","Trim and non-empty check IDs before sending."],"tags":["validation","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"}