eyaltoledano/claude-task-master · warning · Error

projectRoot is required for checkAndAutoSwitchGitTag

Error message

projectRoot is required for checkAndAutoSwitchGitTag

What it means

checkAndAutoSwitchGitTag() requires projectRoot as its first argument for signature consistency, throwing when it is missing even though the function body is currently disabled and returns immediately. The guard exists so future re-enablement and callers keep the correct contract.

Source

Thrown at scripts/modules/utils/git-utils.js:285

	try {
		const currentBranch = await getCurrentBranch(projectRoot);
		const defaultBranch = await getDefaultBranch(projectRoot);
		return currentBranch && defaultBranch && currentBranch === defaultBranch;
	} catch (error) {
		return false;
	}
}

/**
 * Check and automatically switch tags based on git branch if enabled
 * This runs automatically during task operations, similar to migration
 * @param {string} projectRoot - Project root directory (required)
 * @param {string} tasksPath - Path to tasks.json file
 * @returns {Promise<void>}
 */
async function checkAndAutoSwitchGitTag(projectRoot, tasksPath) {
	if (!projectRoot) {
		throw new Error('projectRoot is required for checkAndAutoSwitchGitTag');
	}

	// DISABLED: Automatic git workflow is too rigid and opinionated
	// Users should explicitly use git-tag commands if they want integration
	return;
}

/**
 * Synchronous version of git tag checking and switching
 * This runs during readJSON to ensure git integration happens BEFORE tag resolution
 * @param {string} projectRoot - Project root directory (required)
 * @param {string} tasksPath - Path to tasks.json file
 * @returns {void}
 */
function checkAndAutoSwitchGitTagSync(projectRoot, tasksPath) {
	if (!projectRoot) {
		return; // Can't proceed without project root
	}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass the project root as the first argument
  2. Note the function is a no-op (auto git tag switching is disabled) — consider removing the call entirely
  3. Validate projectRoot resolution before invoking

Example fix

// before
await checkAndAutoSwitchGitTag(tasksPath);
// after
await checkAndAutoSwitchGitTag(projectRoot, tasksPath);
Defensive patterns

Strategy: validation

Validate before calling

if (!projectRoot) { /* function is a no-op anyway */ return; }
await checkAndAutoSwitchGitTag(projectRoot, tasksPath);

Type guard

function hasProjectRoot(root) { return typeof root === 'string' && root.length > 0; }

Try / catch

try {
  await checkAndAutoSwitchGitTag(projectRoot, tasksPath);
} catch (err) {
  if (err.message.includes('projectRoot is required')) console.warn('Skipping git tag check: no project root');
  else throw err;
}

Prevention

When it happens

Trigger: Calling checkAndAutoSwitchGitTag() without a projectRoot string (undefined/null/empty), regardless of tasksPath.

Common situations: Legacy call sites that invoked the helper before projectRoot was threaded through; scripts calling it with only tasksPath.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/4bd9f0edee9e919a. Report an issue: GitHub.