{"record":{"id":"67b06bf481b95edb","repo":"eyaltoledano/claude-task-master","slug":"file-not-found-67b06b","errorCode":"FILE_NOT_FOUND","errorMessage":"Tasks file not found at ${tasksPath}","messagePattern":"Tasks file not found at (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/direct-functions/validate-dependencies.js","lineNumber":48,"sourceCode":"\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\ttry {\n\t\tlog.info(`Validating dependencies in tasks: ${tasksJsonPath}`);\n\n\t\t// Use the provided tasksJsonPath\n\t\tconst tasksPath = tasksJsonPath;\n\n\t\t// Verify the file exists\n\t\tif (!fs.existsSync(tasksPath)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'FILE_NOT_FOUND',\n\t\t\t\t\tmessage: `Tasks file not found at ${tasksPath}`\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Enable silent mode to prevent console logs from interfering with JSON response\n\t\tenableSilentMode();\n\n\t\tconst options = { projectRoot, tag };\n\t\t// Call the original command function using the provided tasksPath\n\t\tawait validateDependenciesCommand(tasksPath, options);\n\n\t\t// Restore normal logging\n\t\tdisableSilentMode();\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tmessage: 'Dependencies validated successfully',","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/validate-dependencies.js#L30-L66","documentation":"validateDependenciesDirect checks fs.existsSync(tasksPath) before reading the file; when the given path does not exist it returns FILE_NOT_FOUND with the path embedded in the message instead of throwing an ENOENT stack trace.","triggerScenarios":"tasksJsonPath points to a file that does not exist — wrong workspace root, project not initialized (no .taskmaster/tasks.json yet), or a typo'd/relative path resolved against a different cwd.","commonSituations":"Running the MCP server from a different directory than the project; task master never initialized (no `task-master init`); file moved or renamed; tests passing a temp path that was cleaned up.","solutions":["Run task-master init (or create .taskmaster/tasks.json) in the project","Pass an absolute path to tasks.json instead of a relative one","Verify the path exists (fs.existsSync) in the caller before invoking the tool"],"exampleFix":"// before\nawait validateDependenciesDirect({ tasksJsonPath: 'tasks.json' });\n// after\nconst tasksPath = path.resolve(process.cwd(), '.taskmaster/tasks.json');\nif (!fs.existsSync(tasksPath)) throw new Error(`tasks.json missing at ${tasksPath}`);\nawait validateDependenciesDirect({ tasksJsonPath: tasksPath });","handlingStrategy":"validation","validationCode":"const tasksPath = path.resolve(projectRoot, '.taskmaster/tasks.json');\nif (!fs.existsSync(tasksPath)) {\n  throw new Error(`tasks.json not found at ${tasksPath}. Run 'task-master init' first.`);\n}","typeGuard":"function tasksFileExists(p: unknown): p is string {\n  return typeof p === 'string' && fs.existsSync(p) && fs.statSync(p).isFile();\n}","tryCatchPattern":"const res = await validateDependenciesDirect({ tasksJsonPath });\nif (!res.success && res.error?.code === 'FILE_NOT_FOUND') {\n  // initialize project or correct the path before retrying\n}","preventionTips":["Run task-master init so .taskmaster/tasks.json exists before using MCP tools","Use absolute paths; avoid relying on the MCP server's cwd","Check fs.existsSync on the path before invoking"],"tags":["mcp","file-not-found","filesystem"],"backgroundTag":"file-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}