{"record":{"id":"136288a0cb63dbca","repo":"eyaltoledano/claude-task-master","slug":"consider-using-project-root-to-specify-the-corre","errorCode":null,"errorMessage":"Consider using --project-root to specify the correct project location or set TASK_MASTER_PROJECT_ROOT environment variable.","messagePattern":"Consider using --project-root to specify the correct project location or set TASK_MASTER_PROJECT_ROOT environment variable\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"mcp-server/src/tools/utils.js","lineNumber":163,"sourceCode":"\t// 4. Check if the current directory has any indicators of being a task-master project\n\tconst currentDir = process.cwd();\n\tif (\n\t\tPROJECT_MARKERS.some((marker) => {\n\t\t\tconst markerPath = path.join(currentDir, marker);\n\t\t\treturn fs.existsSync(markerPath);\n\t\t})\n\t) {\n\t\tlog.info(\n\t\t\t`Using current directory as project root (found project markers): ${currentDir}`\n\t\t);\n\t\treturn currentDir;\n\t}\n\n\t// 5. Default to current working directory but warn the user\n\tlog.warn(\n\t\t`No task-master project detected in current directory. Using ${currentDir} as project root.`\n\t);\n\tlog.warn(\n\t\t'Consider using --project-root to specify the correct project location or set TASK_MASTER_PROJECT_ROOT environment variable.'\n\t);\n\treturn currentDir;\n}\n\n/**\n * Extracts and normalizes the project root path from the MCP session object.\n * @param {Object} session - The MCP session object.\n * @param {Object} log - The MCP logger object.\n * @returns {string|null} - The normalized absolute project root path or null if not found/invalid.\n */\nfunction getProjectRootFromSession(session, log) {\n\ttry {\n\t\t// Add detailed logging of session structure\n\t\tlog.info(\n\t\t\t`Session object: ${JSON.stringify({\n\t\t\t\thasSession: !!session,\n\t\t\t\thasRoots: !!session?.roots,","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/tools/utils.js#L145-L181","documentation":"Companion hint to the previous warning: after defaulting to the current directory because no project markers were found, getProjectRoot advises the user to fix root resolution explicitly via the --project-root flag or the TASK_MASTER_PROJECT_ROOT environment variable. It is informational guidance, not an error.","triggerScenarios":"Same conditions as error 723: getProjectRoot found no project markers and fell back to cwd; this second warn line is always emitted immediately after the first.","commonSituations":"Launching the MCP server outside a project; missing TASK_MASTER_PROJECT_ROOT in docker/CI environments; IDE MCP configs that don't pass env.","solutions":["Set TASK_MASTER_PROJECT_ROOT in the MCP server's env config.","Pass --project-root when launching CLI tools.","Start the server with cwd inside the task-master project."],"exampleFix":"// before\nenv: {}\n// after\nenv: { \"TASK_MASTER_PROJECT_ROOT\": \"/abs/path/to/project\" }","handlingStrategy":"fallback","validationCode":"if (!process.env.TASK_MASTER_PROJECT_ROOT) {\n  console.warn('TASK_MASTER_PROJECT_ROOT not set; pass --project-root to avoid cwd fallback.');\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Set TASK_MASTER_PROJECT_ROOT once in shell profile, container env, or MCP client config.","Prefer explicit --project-root flags in scripts/CI.","Treat this advisory as a signal that error 723's condition occurred and fix root detection."],"tags":["mcp","configuration","environment-variable","hint"],"backgroundTag":"missing-env-var","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}