eyaltoledano/claude-task-master · error · Error
Source tag name is required and must be a string
Error message
Source tag name is required and must be a string
What it means
copyTag() validates that the sourceName argument is a non-empty string before reading tasks.json. This error is thrown when sourceName is missing, null, undefined, empty, or a non-string. The source tag is the tag whose tasks will be duplicated.
Source
Thrown at scripts/modules/task-manager/tag-management.js:1125
context = {},
outputFormat = 'text'
) {
const { mcpLog, projectRoot } = context;
const { description } = options;
// 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 (!sourceName || typeof sourceName !== 'string') {
throw new Error('Source tag name is required and must be a string');
}
if (!targetName || typeof targetName !== 'string') {
throw new Error('Target tag name is required and must be a string');
}
// Validate target tag name format
if (!/^[a-zA-Z0-9_-]+$/.test(targetName)) {
throw new Error(
'Target tag name can only contain letters, numbers, hyphens, and underscores'
);
}
// Reserved tag names
const reservedNames = ['master', 'main', 'default'];
if (reservedNames.includes(targetName.toLowerCase())) {
throw new Error(`"${targetName}" is a reserved tag name`);
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Pass the existing source tag name as the second argument to copyTag as a non-empty string
- Validate the argument before calling: if (!sourceName || typeof sourceName !== 'string') throw ...
- Fix argument order/wiring in the calling CLI or MCP layer
Example fix
// before await copyTag(tasksPath, undefined, 'backup'); // after await copyTag(tasksPath, 'master', 'backup');
Defensive patterns
Strategy: validation
Validate before calling
if (!sourceName || typeof sourceName !== 'string') {
throw new Error('copyTag: sourceName must be a non-empty string');
} Type guard
function isNonEmptyString(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
await copyTag(tasksPath, sourceName, targetName);
} catch (err) {
if (err.message.includes('Source tag name is required')) {
console.error(`Invalid source tag argument: ${JSON.stringify(sourceName)}`);
return;
}
throw err;
} Prevention
- Specify the source tag explicitly when invoking copy commands
- Validate parameters at the CLI/MCP boundary before calling the library
- Check argument order in wrapper helpers so sourceName isn't shifted into options
When it happens
Trigger: Calling copyTag(tasksPath, sourceName, targetName) with sourceName omitted or empty; passing a non-string (e.g. number or object); argument-order mistakes so the value lands in options/context.
Common situations: MCP/CLI callers not forwarding the source tag parameter; scripts building the call dynamically with an unset variable; users running the copy command without specifying which tag to copy.
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
- Old tag name is required and must be a string
- New tag name is required and must be a string
- Target tag name is required and must be a string
- MFA_VERIFICATION_FAILED
- Failed to initialize services: ${(error as Error).message}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/2080ebb80cec2fcc.
Report an issue: GitHub.