eyaltoledano/claude-task-master · warning
No task-master project detected in current directory. Using
Error message
No task-master project detected in current directory. Using ${currentDir} as project root. What it means
getProjectRoot walks up from the current directory looking for project markers (e.g. .taskmaster, tasks.json, .git, package.json). When none are found it falls back to the current working directory and warns that no task-master project was detected. Tools will then operate on ${currentDir}, which likely has no task data.
Source
Thrown at mcp-server/src/tools/utils.js:160
return lastFoundProjectRoot;
}
// 4. Check if the current directory has any indicators of being a task-master project
const currentDir = process.cwd();
if (
PROJECT_MARKERS.some((marker) => {
const markerPath = path.join(currentDir, marker);
return fs.existsSync(markerPath);
})
) {
log.info(
`Using current directory as project root (found project markers): ${currentDir}`
);
return currentDir;
}
// 5. Default to current working directory but warn the user
log.warn(
`No task-master project detected in current directory. Using ${currentDir} as project root.`
);
log.warn(
'Consider using --project-root to specify the correct project location or set TASK_MASTER_PROJECT_ROOT environment variable.'
);
return currentDir;
}
/**
* Extracts and normalizes the project root path from the MCP session object.
* @param {Object} session - The MCP session object.
* @param {Object} log - The MCP logger object.
* @returns {string|null} - The normalized absolute project root path or null if not found/invalid.
*/
function getProjectRootFromSession(session, log) {
try {
// Add detailed logging of session structure
log.info(View on GitHub (pinned to c0c98d367c)
Solutions
- Set the TASK_MASTER_PROJECT_ROOT environment variable to the absolute project path.
- Pass --project-root (or the tool's projectRoot argument) explicitly.
- Start the MCP server from inside the task-master project, or run task-master init to create markers.
- Add a marker file (.taskmaster directory or tasks.json) to the intended root.
Example fix
// before (mcp config)
{ "command": "task-master-mcp", "cwd": "/home/user" }
// after
{ "command": "task-master-mcp", "env": { "TASK_MASTER_PROJECT_ROOT": "/home/user/my-project" } } Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
import path from 'path';
function findProjectRoot(startDir) {
let dir = startDir;
while (dir !== path.parse(dir).root) {
if (fs.existsSync(path.join(dir, '.taskmaster')) || fs.existsSync(path.join(dir, 'tasks.json')))
return dir;
dir = path.dirname(dir);
}
return process.env.TASK_MASTER_PROJECT_ROOT || null; // null => configure explicitly
} Type guard
function hasValidProjectRoot(root) {
return typeof root === 'string' && fs.existsSync(path.join(root, '.taskmaster'));
} Try / catch
null
Prevention
- Always set TASK_MASTER_PROJECT_ROOT in MCP server / CI env config.
- Launch the server from inside the project directory.
- Run task-master init in new projects so markers exist.
- Check startup logs for this warning and fix root resolution before issuing tool calls.
When it happens
Trigger: Running an MCP tool from a directory outside any task-master project, e.g. launching the MCP server with cwd set to $HOME, /tmp, or a fresh folder without .taskmaster/ or tasks.json.
Common situations: MCP client starts the server with the wrong cwd; project nested deeper than the walk-up search; user forgot to run task-master init in the folder; using TASK_MASTER_PROJECT_ROOT unset in containers/CI.
Related errors
- Could not determine project root directory
- Could not determine project root directory
- Could not determine project root directory
- Could not determine project root directory
- Could not determine project root directory
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/a0ad56af96755327.
Report an issue: GitHub.