{"record":{"id":"52cebb2ec1e89256","repo":"eyaltoledano/claude-task-master","slug":"projectroot-is-required-in-args-to-resolve-project","errorCode":null,"errorMessage":"projectRoot is required in args to resolve project paths","messagePattern":"projectRoot is required in args to resolve project paths","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mcp-server/src/core/utils/path-utils.js","lineNumber":182,"sourceCode":"\t\t\t{ projectRoot, tag },\n\t\t\tlog\n\t\t);\n\t}\n\n\t// Fallback to core function without projectRoot context\n\treturn coreFindComplexityReportPath(explicitPath, null, log);\n}\n\n/**\n * Resolve any project-relative path from arguments\n * @param {string} relativePath - Relative path to resolve\n * @param {Object} args - Arguments object containing projectRoot\n * @returns {string} - Resolved absolute path\n */\nexport function resolveProjectPath(relativePath, args) {\n\t// Ensure we have a projectRoot from args\n\tif (!args?.projectRoot) {\n\t\tthrow new Error('projectRoot is required in args to resolve project paths');\n\t}\n\n\t// Normalize the project root to prevent double .taskmaster paths\n\tconst projectRoot = normalizeProjectRoot(args.projectRoot);\n\n\t// If already absolute, return as-is\n\tif (path.isAbsolute(relativePath)) {\n\t\treturn relativePath;\n\t}\n\n\t// Resolve relative to normalized projectRoot\n\treturn path.resolve(projectRoot, relativePath);\n}\n\n/**\n * Find project root using core utility\n * @param {string} [startDir] - Directory to start searching from\n * @returns {string|null} - Project root path or null if not found","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/mcp-server/src/core/utils/path-utils.js#L164-L200","documentation":"resolveProjectPath in mcp-server's path-utils requires args.projectRoot to resolve any relative project path. Without it, the tool cannot anchor relativePath to a project directory, so it throws immediately to prevent writing/reading files relative to an arbitrary working directory.","triggerScenarios":"Calling an MCP tool (e.g. via outputPath) that resolves project paths with an args object lacking projectRoot, or with projectRoot null/undefined.","commonSituations":"MCP client omits projectRoot in tool arguments; tools invoked before project initialization; schema allows optional projectRoot but the resolver requires it.","solutions":["Pass projectRoot (absolute path to the Task Master project) in the tool's args object","Initialize the project first (task-master init) so the MCP server has a project root to use","Check the MCP tool call payload — ensure the argument is named projectRoot and is non-empty"],"exampleFix":"// before\ncallTool('taskmaster', 'outputPath', { relativePath: 'tasks.json' })\n// after\ncallTool('taskmaster', 'outputPath', { relativePath: 'tasks.json', projectRoot: '/abs/path/to/project' })","handlingStrategy":"validation","validationCode":"function assertProjectRoot(args) {\n  if (!args || typeof args.projectRoot !== 'string' || args.projectRoot.length === 0) {\n    throw new Error('projectRoot (non-empty string) is required in args');\n  }\n}","typeGuard":"function hasProjectRoot(args) {\n  return typeof args === 'object' && args !== null &&\n    typeof args.projectRoot === 'string' && args.projectRoot.length > 0;\n}","tryCatchPattern":"try { const p = resolveProjectPath(rel, args); } catch (e) {\n  if (e.message.includes('projectRoot is required')) { /* prompt user for project root */ }\n  else throw e;\n}","preventionTips":["Always pass projectRoot in MCP tool arguments; make it required in tool schemas","Run task-master init before invoking tools against a project","Validate args with the tool's input schema before dispatching"],"tags":["mcp","path-resolution","missing-argument","config"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}