eyaltoledano/claude-task-master · error
Failed to fetch tasks from any tag. First error: ${failedTag
Error message
Failed to fetch tasks from any tag. First error: ${failedTags[0].error} What it means
createTagFromBranch requires branchName to be a non-empty string before attempting to convert it into a tag name. Passing nothing, an empty string, or a non-string (null/number/object) fails this guard.
Source
Thrown at apps/cli/src/commands/list.command.ts:449
// Warn about failed tags
if (failedTags.length > 0) {
console.warn(
chalk.yellow(
`\nWarning: Could not fetch tasks from ${failedTags.length} tag(s):`
)
);
failedTags.forEach(({ name, error }) => {
console.warn(chalk.gray(` ${name}: ${error}`));
});
}
// If ALL tags failed, throw to surface the issue
if (
failedTags.length === tagsResult.tags.length &&
tagsResult.tags.length > 0
) {
throw new Error(
`Failed to fetch tasks from any tag. First error: ${failedTags[0].error}`
);
}
// Apply additional filters
let filteredTasks: TaskWithTag[] = allTaggedTasks;
// Apply blocking filter if specified
if (options.blocking) {
filteredTasks = filteredTasks.filter((task) => task.blocks.length > 0);
}
// Apply status filter if specified
if (options.status && options.status !== 'all') {
const statusValues = options.status
.split(',')
.map((s) => s.trim() as TaskStatus);
filteredTasks = filteredTasks.filter((task) =>View on GitHub (pinned to c0c98d367c)
Solutions
- Ensure a branch name string is passed: createTagFromBranch(tasksPath, 'feature/x', ...)
- Resolve the current branch with `git branch --show-current` and check it is non-empty first
- Coerce/trim user input and reject empty values before calling
Example fix
// before
const branch = execSync('git branch --show-current').toString(); // detached HEAD => ''
await createTagFromBranch(tasksPath, branch);
// after
const branch = execSync('git branch --show-current').toString().trim();
if (!branch) throw new Error('Not on a branch (detached HEAD)');
await createTagFromBranch(tasksPath, branch); Defensive patterns
Strategy: validation
Validate before calling
if (typeof branchName !== 'string' || !branchName.trim()) {
throw new Error('branchName must be a non-empty string');
} Type guard
const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;
Try / catch
try {
await createTagFromBranch(tasksPath, branchName);
} catch (e) {
if (e.message.includes('Branch name is required')) {
throw new Error('Provide a branch name, e.g. task-master create-tag-from-branch feature/x');
}
throw e;
} Prevention
- Resolve the current branch and fail fast on empty output (detached HEAD)
- Validate CLI argument presence before invoking library functions
- Coerce and trim inputs at the boundary
When it happens
Trigger: Calling createTagFromBranch(tasksPath, branchName, ...) with branchName undefined, '', or a non-string value, e.g. from unparseable git branch command output.
Common situations: Scripting where `git branch --show-current` returned empty (detached HEAD); passing an undefined process.argv value; wiring a UI field that was never filled in.
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
- ${authCheck.error}
- MFA_VERIFICATION_FAILED
- Failed to initialize services: ${(error as Error).message}
- Invalid format: ${options.format}. Valid formats are: text,
- Project path is required
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/bdfd98cd53f119e4.
Report an issue: GitHub.