{"record":{"id":"daabe2c826258d85","repo":"eyaltoledano/claude-task-master","slug":"file-not-found","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/fix-dependencies.js","lineNumber":47,"sourceCode":"\t\t\tlog.error('fixDependenciesDirect 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// Use provided path\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 path and proper context\n\t\tawait fixDependenciesCommand(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: {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/direct-functions/fix-dependencies.js#L29-L65","documentation":"After receiving tasksJsonPath, fixDependenciesDirect verifies the file exists on disk with fs.existsSync. A missing file yields a FILE_NOT_FOUND error result naming the path that was checked. It prevents the core dependency-fix logic from failing obscurely on a nonexistent file.","triggerScenarios":"tasksJsonPath points to a path that does not exist: wrong project root, file not yet initialized, renamed .taskmaster directory, or path with wrong casing/tilde left unexpanded.","commonSituations":"Running the MCP server before ever initializing the project; passing an absolute path from another machine/container; typos like tasks.jsn; symlinked roots broken after a checkout.","solutions":["Verify the path with ls/existsSync and correct any typo","Run project initialization (task_master init or initialize_project) to create tasks.json if it does not exist","Pass the canonical path: <projectRoot>/.taskmaster/tasks/tasks.json","If using ~ or env vars in the path, expand them client-side before sending"],"exampleFix":"// before\nawait mcp.call('fix_dependencies', { tasksJsonPath: '~/repo/.taskmaster/tasks/tasks.json' });\n// after\nimport path from 'path';\nimport os from 'os';\nconst p = path.join(os.homedir(), 'repo/.taskmaster/tasks/tasks.json');\nif (!fs.existsSync(p)) throw new Error(`tasks.json missing at ${p}; run init first`);\nawait mcp.call('fix_dependencies', { tasksJsonPath: p });","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nimport path from 'path';\nconst tasksPath = path.resolve(projectRoot, '.taskmaster/tasks/tasks.json');\nif (!fs.existsSync(tasksPath)) {\n  throw new Error(`tasks.json not found at ${tasksPath}. Run initialize_project first.`);\n}\nif (!fs.statSync(tasksPath).isFile()) {\n  throw new Error(`${tasksPath} is not a file`);\n}","typeGuard":"function tasksFileExists(p) {\n  try { return fs.statSync(p).isFile(); } catch { return false; }\n}","tryCatchPattern":"const res = await callTool('fix_dependencies', { tasksJsonPath });\nif (!res.success && res.error?.code === 'FILE_NOT_FOUND') {\n  console.error(res.error.message); // names the exact path checked\n  // recover: initialize the project or correct the path, then retry\n}","preventionTips":["Always path.resolve + existsSync before file-based MCP calls","Initialize projects before invoking task tools against them","Avoid '~' and unexpanded env vars in paths sent to MCP tools","Watch for casing mismatches on case-sensitive filesystems"],"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"}