{"record":{"id":"716518513bd60f9e","repo":"eyaltoledano/claude-task-master","slug":"cannot-rename-the-master-tag","errorCode":null,"errorMessage":"Cannot rename the \"master\" tag","messagePattern":"Cannot rename the \"master\" tag","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/tag-management.js","lineNumber":974,"sourceCode":"\ttry {\n\t\t// Validate parameters\n\t\tif (!oldName || typeof oldName !== 'string') {\n\t\t\tthrow new Error('Old tag name is required and must be a string');\n\t\t}\n\t\tif (!newName || typeof newName !== 'string') {\n\t\t\tthrow new Error('New tag name is required and must be a string');\n\t\t}\n\n\t\t// Validate new tag name format\n\t\tif (!/^[a-zA-Z0-9_-]+$/.test(newName)) {\n\t\t\tthrow new Error(\n\t\t\t\t'New tag name can only contain letters, numbers, hyphens, and underscores'\n\t\t\t);\n\t\t}\n\n\t\t// Prevent renaming master tag\n\t\tif (oldName === 'master') {\n\t\t\tthrow new Error('Cannot rename the \"master\" tag');\n\t\t}\n\n\t\t// Reserved tag names\n\t\tconst reservedNames = ['master', 'main', 'default'];\n\t\tif (reservedNames.includes(newName.toLowerCase())) {\n\t\t\tthrow new Error(`\"${newName}\" is a reserved tag name`);\n\t\t}\n\n\t\tlogFn.info(`Renaming tag from \"${oldName}\" to \"${newName}\"`);\n\n\t\t// Read current tasks data\n\t\tconst data = readJSON(tasksPath, projectRoot);\n\t\tif (!data) {\n\t\t\tthrow new Error(`Could not read tasks file at ${tasksPath}`);\n\t\t}\n\n\t\t// Use raw tagged data for tag operations\n\t\tconst rawData = data._rawTaggedData || data;","sourceCodeStart":956,"sourceCodeEnd":992,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/tag-management.js#L956-L992","documentation":"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.","triggerScenarios":"Calling renameTag(tasksPath, 'master', anything) — any attempt to rename the master tag, regardless of the new name's validity.","commonSituations":"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.","solutions":["Do not rename 'master'; create a new tag with createTag and copy tasks with copyTag if a different default is needed","Skip the 'master' tag in bulk-rename loops (if (tag === 'master') continue;)","Keep using 'master' as the default tag and rename only your custom tags"],"exampleFix":"// before\nfor (const tag of allTags) await renameTag(tasksPath, tag, tag + '-old');\n// after\nfor (const tag of allTags) {\n  if (tag === 'master') continue;\n  await renameTag(tasksPath, tag, tag + '-old');\n}","handlingStrategy":"validation","validationCode":"if (oldName === 'master') {\n  throw new Error('The master tag cannot be renamed');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await renameTag(tasksPath, oldName, newName);\n} catch (err) {\n  if (err.message.includes('Cannot rename the \"master\" tag')) {\n    console.error('master is protected; create a new tag and copy tasks instead');\n    return;\n  }\n  throw err;\n}","preventionTips":["Treat 'master' as immutable in any tag-management code","Skip 'master' in loops that rename or clean up tags","To change your default workflow, create a new tag with createTag and switch with useTag instead of renaming"],"tags":["tag-management","protected-resource","validation"],"backgroundTag":"protected-resource-modification","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}