eyaltoledano/claude-task-master · warning
Tag "${tagName}" for branch "${currentBranch}" does not exis
Error message
Tag "${tagName}" for branch "${currentBranch}" does not exist What it means
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.
Source
Thrown at scripts/modules/task-manager/tag-management.js:1571
context,
outputFormat
);
// Update mapping if it didn't exist
if (!(await getTagForBranch(projectRoot, currentBranch))) {
await updateBranchTagMapping(projectRoot, currentBranch, tagName);
}
return {
switched: true,
created: false,
branchName: currentBranch,
tagName,
...switchResult
};
} else {
// Tag doesn't exist and createIfMissing is false
logFn.warn(
`Tag "${tagName}" for branch "${currentBranch}" does not exist`
);
return {
switched: false,
reason: 'tag_not_found',
branchName: currentBranch,
tagName
};
}
} catch (error) {
logFn.error(`Error in auto-switch tag for branch: ${error.message}`);
throw error;
}
}
/**
* Check git workflow configuration and perform auto-switch if enabled
* @param {string} projectRoot - Project root directoryView on GitHub (pinned to c0c98d367c)
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.
Example fix
// before
const r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: false });
// after
const r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: true }); Defensive patterns
Strategy: validation
Validate before calling
const tags = JSON.parse(fs.readFileSync(path.join(projectRoot, '.taskmaster/tasks.json'),'utf8')).tags || {};
const tagName = deriveTagForBranch(currentBranch); // your mapping
if (!tags[tagName]) {
await createTag(rawData, tagName, projectRoot, {}); // create before switching
} Type guard
function tagExists(rawData, tagName) {
return Boolean(rawData?.tags?.[tagName]);
} Try / catch
const r = await autoSwitchTagForBranch(projectRoot, { createIfMissing: true });
if (!r.switched && r.reason === 'tag_not_found') {
// fall back to manual tag creation
} Prevention
- 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.
When it happens
Trigger: 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'.
Common situations: 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.
Related errors
- not a git repository: ${this.projectPath} Please run this co
- NOT_GIT_REPOSITORY
- Not in a git repository, cannot auto-switch tags
- Failed to fetch tasks from any tag. First error: ${failedTag
- ${authCheck.error}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/2850d032b0f981b4.
Report an issue: GitHub.