{"record":{"id":"356edc906cc8f7ca","repo":"eyaltoledano/claude-task-master","slug":"could-not-determine-project-root-directory-356edc","errorCode":null,"errorMessage":"Could not determine project root directory","messagePattern":"Could not determine project root directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/update-subtask-by-id.js","lineNumber":92,"sourceCode":"\t\treport('info', `Updating subtask ${subtaskId} with prompt: \"${prompt}\"`);\n\n\t\t// Basic validation - ID must be present\n\t\tif (!subtaskId || typeof subtaskId !== 'string') {\n\t\t\tthrow new Error('Subtask ID cannot be empty.');\n\t\t}\n\t\t// Allow metadata-only updates (no prompt required if metadata is provided)\n\t\tif (\n\t\t\t(!prompt || typeof prompt !== 'string' || prompt.trim() === '') &&\n\t\t\t!metadata\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t'Prompt cannot be empty unless metadata is provided. Please provide context for the subtask update or metadata to merge.'\n\t\t\t);\n\t\t}\n\n\t\tconst projectRoot = providedProjectRoot || findProjectRoot();\n\t\tif (!projectRoot) {\n\t\t\tthrow new Error('Could not determine project root directory');\n\t\t}\n\n\t\t// --- BRIDGE: Try remote update first (API storage) ---\n\t\t// In API storage, subtask IDs like \"HAM-2611\" are just regular task IDs\n\t\t// So update-subtask and update-task work identically\n\t\tconst remoteResult = await tryUpdateViaRemote({\n\t\t\ttaskId: subtaskId,\n\t\t\tprompt,\n\t\t\tprojectRoot,\n\t\t\ttag,\n\t\t\tappendMode: true, // Subtask updates are always append mode\n\t\t\tuseResearch,\n\t\t\tmetadata,\n\t\t\tisMCP,\n\t\t\toutputFormat,\n\t\t\treport\n\t\t});\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/update-subtask-by-id.js#L74-L110","documentation":"After argument validation, the function resolves the project root via findProjectRoot() unless one was provided. If neither yields a root (no .taskmaster/tasks.json/markers found up the directory tree), it throws.","triggerScenarios":"Running from a directory outside any task-master project without passing projectRoot; findProjectRoot() failing because the .taskmaster directory is missing or the process cwd is outside the repo.","commonSituations":"MCP servers launched with a cwd that is not the project, scripts run from /tmp or the home directory, repos where task-master init was never run.","solutions":["Pass projectRoot explicitly in options/context","Run the command from inside the project directory that contains .taskmaster","Run 'task-master init' to create the project markers"],"exampleFix":"// before\nawait updateSubtaskById('5.2', prompt, {}); // cwd has no .taskmaster\n// after\nawait updateSubtaskById('5.2', prompt, { projectRoot: '/path/to/project' });","handlingStrategy":"fallback","validationCode":"const projectRoot = providedProjectRoot || findProjectRoot();\nif (!projectRoot) {\n  throw new Error('No task-master project found from cwd; pass projectRoot');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await updateSubtaskById(subtaskId, prompt, options);\n} catch (err) {\n  if (err.message === 'Could not determine project root directory') {\n    await updateSubtaskById(subtaskId, prompt, { ...options, projectRoot: process.env.TM_PROJECT_ROOT });\n  } else throw err;\n}","preventionTips":["Run commands from the repo containing .taskmaster","Set an explicit projectRoot in MCP server config","Run task-master init before automation"],"tags":["configuration","project-root"],"backgroundTag":"project-root-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}