{"record":{"id":"bdfd98cd53f119e4","repo":"eyaltoledano/claude-task-master","slug":"failed-to-fetch-tasks-from-any-tag-first-error","errorCode":null,"errorMessage":"Failed to fetch tasks from any tag. First error: ${failedTags[0].error}","messagePattern":"Failed to fetch tasks from any tag\\. First error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/cli/src/commands/list.command.ts","lineNumber":449,"sourceCode":"\n\t\t// Warn about failed tags\n\t\tif (failedTags.length > 0) {\n\t\t\tconsole.warn(\n\t\t\t\tchalk.yellow(\n\t\t\t\t\t`\\nWarning: Could not fetch tasks from ${failedTags.length} tag(s):`\n\t\t\t\t)\n\t\t\t);\n\t\t\tfailedTags.forEach(({ name, error }) => {\n\t\t\t\tconsole.warn(chalk.gray(`  ${name}: ${error}`));\n\t\t\t});\n\t\t}\n\n\t\t// If ALL tags failed, throw to surface the issue\n\t\tif (\n\t\t\tfailedTags.length === tagsResult.tags.length &&\n\t\t\ttagsResult.tags.length > 0\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`Failed to fetch tasks from any tag. First error: ${failedTags[0].error}`\n\t\t\t);\n\t\t}\n\n\t\t// Apply additional filters\n\t\tlet filteredTasks: TaskWithTag[] = allTaggedTasks;\n\n\t\t// Apply blocking filter if specified\n\t\tif (options.blocking) {\n\t\t\tfilteredTasks = filteredTasks.filter((task) => task.blocks.length > 0);\n\t\t}\n\n\t\t// Apply status filter if specified\n\t\tif (options.status && options.status !== 'all') {\n\t\t\tconst statusValues = options.status\n\t\t\t\t.split(',')\n\t\t\t\t.map((s) => s.trim() as TaskStatus);\n\t\t\tfilteredTasks = filteredTasks.filter((task) =>","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/apps/cli/src/commands/list.command.ts#L431-L467","documentation":"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.","triggerScenarios":"Calling createTagFromBranch(tasksPath, branchName, ...) with branchName undefined, '', or a non-string value, e.g. from unparseable git branch command output.","commonSituations":"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.","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"],"exampleFix":"// before\nconst branch = execSync('git branch --show-current').toString(); // detached HEAD => ''\nawait createTagFromBranch(tasksPath, branch);\n// after\nconst branch = execSync('git branch --show-current').toString().trim();\nif (!branch) throw new Error('Not on a branch (detached HEAD)');\nawait createTagFromBranch(tasksPath, branch);","handlingStrategy":"validation","validationCode":"if (typeof branchName !== 'string' || !branchName.trim()) {\n  throw new Error('branchName must be a non-empty string');\n}","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n  await createTagFromBranch(tasksPath, branchName);\n} catch (e) {\n  if (e.message.includes('Branch name is required')) {\n    throw new Error('Provide a branch name, e.g. task-master create-tag-from-branch feature/x');\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["validation","git","tag-management"],"backgroundTag":"missing-required-argument","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}