{"record":{"id":"d7d2c3baf2c90acd","repo":"eyaltoledano/claude-task-master","slug":"tasks-file-not-found-at-path-taskspath","errorCode":null,"errorMessage":"Tasks file not found at path: ${tasksPath}","messagePattern":"Tasks file not found at path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/update-subtask-by-id.js","lineNumber":130,"sourceCode":"\t\tif (remoteResult) {\n\t\t\treturn {\n\t\t\t\tupdatedSubtask: { id: subtaskId },\n\t\t\t\ttelemetryData: remoteResult.telemetryData,\n\t\t\t\ttagInfo: remoteResult.tagInfo\n\t\t\t};\n\t\t}\n\t\t// Otherwise fall through to file-based logic below\n\t\t// --- End BRIDGE ---\n\n\t\t// For file storage, validate the subtask ID format (must contain a dot)\n\t\tif (!subtaskId.includes('.')) {\n\t\t\tthrow new Error(\n\t\t\t\t`Invalid subtask ID format: ${subtaskId}. In solo mode, subtask ID must be in format \"parentId.subtaskId\" (e.g., \"5.2\").`\n\t\t\t);\n\t\t}\n\n\t\tif (!fs.existsSync(tasksPath)) {\n\t\t\tthrow new Error(`Tasks file not found at path: ${tasksPath}`);\n\t\t}\n\n\t\tconst data = readJSON(tasksPath, projectRoot, tag);\n\t\tif (!data || !data.tasks) {\n\t\t\tthrow new Error(\n\t\t\t\t`No valid tasks found in ${tasksPath}. The file may be corrupted or have an invalid format.`\n\t\t\t);\n\t\t}\n\n\t\tconst [parentIdStr, subtaskIdStr] = subtaskId.split('.');\n\t\tconst parentId = parseInt(parentIdStr, 10);\n\t\tconst subtaskIdNum = parseInt(subtaskIdStr, 10);\n\n\t\tif (\n\t\t\tNumber.isNaN(parentId) ||\n\t\t\tparentId <= 0 ||\n\t\t\tNumber.isNaN(subtaskIdNum) ||\n\t\t\tsubtaskIdNum <= 0","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/update-subtask-by-id.js#L112-L148","documentation":"In file-storage mode the function checks fs.existsSync(tasksPath) before reading. If the tasks file does not exist at the resolved path it throws with the full path in the message.","triggerScenarios":"tasksPath pointing at a missing .taskmaster/tasks.json, wrong --file flag value, or a project where tasks.json was never initialized or was deleted.","commonSituations":"Typos in the file path, running in CI before the tasks file is generated, switching branches where tasks.json is gitignored and absent.","solutions":["Verify the path exists: ls .taskmaster/tasks.json","Run 'task-master init' or 'task-master generate' to create the file","Pass the correct --file path explicitly"],"exampleFix":"// before\nawait updateSubtaskById('5.2', prompt, { tasksPath: './tasks.json' }); // wrong path\n// after\nconst tasksPath = path.join(projectRoot, '.taskmanager', 'tasks.json');\nif (!fs.existsSync(tasksPath)) throw new Error(`Missing ${tasksPath}; run task-master init`);\nawait updateSubtaskById('5.2', prompt, { tasksPath });","handlingStrategy":"validation","validationCode":"if (!fs.existsSync(tasksPath)) {\n  throw new Error(`Tasks file missing: ${tasksPath}`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await updateSubtaskById(subtaskId, prompt, options);\n} catch (err) {\n  if (err.message.startsWith('Tasks file not found')) {\n    console.error(`Initialize the project (task-master init) or fix --file: ${err.message}`);\n  } else throw err;\n}","preventionTips":["Resolve tasksPath from projectRoot, not relative cwd","Check fs.existsSync before automation runs","Commit or generate tasks.json in CI before task updates"],"tags":["filesystem","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}