{"record":{"id":"2080ebb80cec2fcc","repo":"eyaltoledano/claude-task-master","slug":"source-tag-name-is-required-and-must-be-a-string","errorCode":null,"errorMessage":"Source tag name is required and must be a string","messagePattern":"Source tag name is required and must be a string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/tag-management.js","lineNumber":1125,"sourceCode":"\tcontext = {},\n\toutputFormat = 'text'\n) {\n\tconst { mcpLog, projectRoot } = context;\n\tconst { description } = options;\n\n\t// Create a consistent logFn object regardless of context\n\tconst logFn = mcpLog || {\n\t\tinfo: (...args) => log('info', ...args),\n\t\twarn: (...args) => log('warn', ...args),\n\t\terror: (...args) => log('error', ...args),\n\t\tdebug: (...args) => log('debug', ...args),\n\t\tsuccess: (...args) => log('success', ...args)\n\t};\n\n\ttry {\n\t\t// Validate parameters\n\t\tif (!sourceName || typeof sourceName !== 'string') {\n\t\t\tthrow new Error('Source tag name is required and must be a string');\n\t\t}\n\t\tif (!targetName || typeof targetName !== 'string') {\n\t\t\tthrow new Error('Target tag name is required and must be a string');\n\t\t}\n\n\t\t// Validate target tag name format\n\t\tif (!/^[a-zA-Z0-9_-]+$/.test(targetName)) {\n\t\t\tthrow new Error(\n\t\t\t\t'Target tag name can only contain letters, numbers, hyphens, and underscores'\n\t\t\t);\n\t\t}\n\n\t\t// Reserved tag names\n\t\tconst reservedNames = ['master', 'main', 'default'];\n\t\tif (reservedNames.includes(targetName.toLowerCase())) {\n\t\t\tthrow new Error(`\"${targetName}\" is a reserved tag name`);\n\t\t}\n","sourceCodeStart":1107,"sourceCodeEnd":1143,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/tag-management.js#L1107-L1143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait copyTag(tasksPath, undefined, 'backup');\n// after\nawait copyTag(tasksPath, 'master', 'backup');","handlingStrategy":"validation","validationCode":"if (!sourceName || typeof sourceName !== 'string') {\n  throw new Error('copyTag: sourceName must be a non-empty string');\n}","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  await copyTag(tasksPath, sourceName, targetName);\n} catch (err) {\n  if (err.message.includes('Source tag name is required')) {\n    console.error(`Invalid source tag argument: ${JSON.stringify(sourceName)}`);\n    return;\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["validation","parameter-validation","tag-management"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}