{"record":{"id":"2850d032b0f981b4","repo":"eyaltoledano/claude-task-master","slug":"tag-tagname-for-branch-currentbranch-doe","errorCode":null,"errorMessage":"Tag \"${tagName}\" for branch \"${currentBranch}\" does not exist","messagePattern":"Tag \"(.+?)\" for branch \"(.+?)\" does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"scripts/modules/task-manager/tag-management.js","lineNumber":1571,"sourceCode":"\t\t\t\tcontext,\n\t\t\t\toutputFormat\n\t\t\t);\n\n\t\t\t// Update mapping if it didn't exist\n\t\t\tif (!(await getTagForBranch(projectRoot, currentBranch))) {\n\t\t\t\tawait updateBranchTagMapping(projectRoot, currentBranch, tagName);\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tswitched: true,\n\t\t\t\tcreated: false,\n\t\t\t\tbranchName: currentBranch,\n\t\t\t\ttagName,\n\t\t\t\t...switchResult\n\t\t\t};\n\t\t} else {\n\t\t\t// Tag doesn't exist and createIfMissing is false\n\t\t\tlogFn.warn(\n\t\t\t\t`Tag \"${tagName}\" for branch \"${currentBranch}\" does not exist`\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tswitched: false,\n\t\t\t\treason: 'tag_not_found',\n\t\t\t\tbranchName: currentBranch,\n\t\t\t\ttagName\n\t\t\t};\n\t\t}\n\t} catch (error) {\n\t\tlogFn.error(`Error in auto-switch tag for branch: ${error.message}`);\n\t\tthrow error;\n\t}\n}\n\n/**\n * Check git workflow configuration and perform auto-switch if enabled\n * @param {string} projectRoot - Project root directory","sourceCodeStart":1553,"sourceCodeEnd":1589,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/tag-management.js#L1553-L1589","documentation":"When autoSwitchTagForBranch resolves the current branch and derives/looks up a tagName for it, and the tag does not exist in tasks.json while createIfMissing is false, it warns and returns { switched: false, reason: 'tag_not_found' } along with the branch and tag names. No tag switch happens and no tag is created.","triggerScenarios":"Calling autoSwitchTagForBranch with createIfMissing=false (the default or explicitly set) for a branch whose mapped tag has never been created via createTag / 'task-master add-tag'.","commonSituations":"Starting work on a new feature branch before creating its tag; cloning a repo where tasks.json was reverted/changed and branch tags no longer exist; disabling createIfMissing in stricter configs; branch-name-to-tag mapping mismatches after renaming branches.","solutions":["Call with createIfMissing: true (or CLI equivalent) so the tag is created automatically for the branch.","Create the tag manually once: 'task-master add-tag <tagName>' matching the branch mapping.","Switch to a branch that already has a corresponding tag.","Align branch naming with existing tags or update the mapping so the derived tagName matches an existing tag."],"exampleFix":"// before\nconst r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: false });\n// after\nconst r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: true });","handlingStrategy":"validation","validationCode":"const tags = JSON.parse(fs.readFileSync(path.join(projectRoot, '.taskmaster/tasks.json'),'utf8')).tags || {};\nconst tagName = deriveTagForBranch(currentBranch); // your mapping\nif (!tags[tagName]) {\n  await createTag(rawData, tagName, projectRoot, {}); // create before switching\n}","typeGuard":"function tagExists(rawData, tagName) {\n  return Boolean(rawData?.tags?.[tagName]);\n}","tryCatchPattern":"const r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: true });\nif (!r.switched && r.reason === 'tag_not_found') {\n  // fall back to manual tag creation\n}","preventionTips":["Create a tag for each new branch before starting work.","Prefer createIfMissing: true in automated flows.","Keep branch names and tag names aligned with one documented mapping.","Audit tasks.json tags after branch renames."],"tags":["git","tagging","configuration"],"backgroundTag":"tag-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}