eyaltoledano/claude-task-master · error · Error

New tag name is required and must be a string

Error message

New tag name is required and must be a string

What it means

renameTag() requires the new tag name to be a non-empty string. This error is thrown when newName is missing, null, undefined, empty, or a non-string type. It ensures the new tag key written into the tagged tasks data is a valid string.

Source

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

) {
	const { mcpLog, projectRoot } = context;

	// Create a consistent logFn object regardless of context
	const logFn = mcpLog || {
		info: (...args) => log('info', ...args),
		warn: (...args) => log('warn', ...args),
		error: (...args) => log('error', ...args),
		debug: (...args) => log('debug', ...args),
		success: (...args) => log('success', ...args)
	};

	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`);

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pass a non-empty string as the third argument (newName) to renameTag
  2. Validate newName before calling: if (!newName || typeof newName !== 'string') throw ...
  3. Fix argument order if values were passed in the wrong positions

Example fix

// before
await renameTag(tasksPath, 'backlog'); // newName missing
// after
await renameTag(tasksPath, 'backlog', 'archived-backlog');
Defensive patterns

Strategy: validation

Validate before calling

if (!newName || typeof newName !== 'string') {
  throw new Error('renameTag: newName must be a non-empty string');
}

Type guard

function isNonEmptyString(v) {
  return typeof v === 'string' && v.trim().length > 0;
}

Try / catch

try {
  await renameTag(tasksPath, oldName, newName);
} catch (err) {
  if (err.message.includes('New tag name is required')) {
    console.error('Missing or invalid new tag name — prompt the user again');
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling renameTag(tasksPath, oldName, newName) with newName omitted, empty string, null, or a non-string value such as a number or object.

Common situations: Prompt/CLI flows where the user cancelled the name prompt and undefined was forwarded; JSON config files missing the new-name field; programmatic callers mixing up argument order so the value lands elsewhere.

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/70b25a2449307a35. Report an issue: GitHub.