eyaltoledano/claude-task-master · error · Error

Cannot rename the "master" tag

Error message

Cannot rename the "master" tag

What it means

The 'master' tag is protected: it is the default/root tag that Task Master creates and falls back to. renameTag() explicitly refuses to rename it so the default tag reference stays valid. Use createTag + copyTag to migrate content to a new tag instead.

Source

Thrown at scripts/modules/task-manager/tag-management.js:974

	try {
		// Validate parameters
		if (!oldName || typeof oldName !== 'string') {
			throw new Error('Old tag name is required and must be a string');
		}
		if (!newName || typeof newName !== 'string') {
			throw new Error('New tag name is required and must be a string');
		}

		// Validate new tag name format
		if (!/^[a-zA-Z0-9_-]+$/.test(newName)) {
			throw new Error(
				'New tag name can only contain letters, numbers, hyphens, and underscores'
			);
		}

		// Prevent renaming master tag
		if (oldName === 'master') {
			throw new Error('Cannot rename the "master" tag');
		}

		// Reserved tag names
		const reservedNames = ['master', 'main', 'default'];
		if (reservedNames.includes(newName.toLowerCase())) {
			throw new Error(`"${newName}" is a reserved tag name`);
		}

		logFn.info(`Renaming tag from "${oldName}" to "${newName}"`);

		// Read current tasks data
		const data = readJSON(tasksPath, projectRoot);
		if (!data) {
			throw new Error(`Could not read tasks file at ${tasksPath}`);
		}

		// Use raw tagged data for tag operations
		const rawData = data._rawTaggedData || data;

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Do not rename 'master'; create a new tag with createTag and copy tasks with copyTag if a different default is needed
  2. Skip the 'master' tag in bulk-rename loops (if (tag === 'master') continue;)
  3. Keep using 'master' as the default tag and rename only your custom tags

Example fix

// before
for (const tag of allTags) await renameTag(tasksPath, tag, tag + '-old');
// after
for (const tag of allTags) {
  if (tag === 'master') continue;
  await renameTag(tasksPath, tag, tag + '-old');
}
Defensive patterns

Strategy: validation

Validate before calling

if (oldName === 'master') {
  throw new Error('The master tag cannot be renamed');
}

Type guard

null

Try / catch

try {
  await renameTag(tasksPath, oldName, newName);
} catch (err) {
  if (err.message.includes('Cannot rename the "master" tag')) {
    console.error('master is protected; create a new tag and copy tasks instead');
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling renameTag(tasksPath, 'master', anything) — any attempt to rename the master tag, regardless of the new name's validity.

Common situations: Teams wanting to rename 'master' to something like 'main' or 'production' for convention reasons; cleanup scripts iterating over all tags and blindly renaming each one.

Related errors


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