{"record":{"id":"c72b485b851848d4","repo":"eyaltoledano/claude-task-master","slug":"tag-tagname-does-not-exist","errorCode":null,"errorMessage":"Tag \"${tagName}\" does not exist","messagePattern":"Tag \"(.+?)\" does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/tag-management.js","lineNumber":313,"sourceCode":"\t\t\t\t\t\tcreated: new Date().toISOString(),\n\t\t\t\t\t\tupdated: new Date().toISOString(),\n\t\t\t\t\t\tdescription: 'Tasks live here by default'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\t// This is already in tagged format, use it directly but exclude internal fields\n\t\t\trawData = {};\n\t\t\tfor (const [key, value] of Object.entries(data)) {\n\t\t\t\tif (key !== '_rawTaggedData' && key !== 'tag') {\n\t\t\t\t\trawData[key] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Check if tag exists\n\t\tif (!rawData[tagName]) {\n\t\t\tthrow new Error(`Tag \"${tagName}\" does not exist`);\n\t\t}\n\n\t\t// Get current tag to check if we're deleting the active tag\n\t\tconst currentTag = getCurrentTag(projectRoot);\n\t\tconst isCurrentTag = currentTag === tagName;\n\n\t\t// Get task count for confirmation\n\t\tconst tasks = getTasksForTag(rawData, tagName);\n\t\tconst taskCount = tasks.length;\n\n\t\t// If not forced and has tasks, require confirmation (for CLI)\n\t\tif (!yes && taskCount > 0 && outputFormat === 'text') {\n\t\t\tconsole.log(\n\t\t\t\tboxen(\n\t\t\t\t\tchalk.yellow.bold('⚠ WARNING: Tag Deletion') +\n\t\t\t\t\t\t`\\n\\nYou are about to delete tag \"${chalk.cyan(tagName)}\"` +\n\t\t\t\t\t\t`\\nThis will permanently delete ${chalk.red.bold(taskCount)} tasks` +\n\t\t\t\t\t\t'\\n\\nThis action cannot be undone!',","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/tag-management.js#L295-L331","documentation":"After loading and normalizing the tagged data, deleteTag() looks up rawData[tagName]. If no tag with that exact name exists in tasks.json, it throws this error. Tag lookups are exact string matches, so case or whitespace differences also count as nonexistent.","triggerScenarios":"Calling deleteTag with a tag name that was never created, a typo'd or case-mismatched name ('Backend' vs 'backend'), deleting a tag that was already removed, or operating on a stale tasksPath that doesn't contain the tag.","commonSituations":"Scripts iterating over a cached/old tag list after another process deleted tags, users typing tag names from memory, CI pipelines referencing a tag only present in another environment's tasks.json.","solutions":["Run `task-master tags` (or call the tags() function) to list existing tags and use an exact name from that output.","Check spelling and casing — tag keys are matched exactly against the tasks.json top-level keys.","Make the deletion conditional: skip or no-op when the tag is absent instead of treating it as fatal."],"exampleFix":"// before\nawait deleteTag(tasksPath, 'Feature_X', options, context);\n// after\nconst { tags } = await tags(tasksPath, context);\nif (tags.some((t) => t.name === 'feature-x')) {\n  await deleteTag(tasksPath, 'feature-x', options, context);\n}","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nconst data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));\nif (!data[tagName]) {\n  throw new Error(`Tag \"${tagName}\" does not exist; available: ${Object.keys(data).filter(k => !k.startsWith('_')).join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await deleteTag(tasksPath, tag, opts, ctx);\n} catch (e) {\n  if (e.message.includes('does not exist')) {\n    console.warn(`Tag \"${tag}\" already absent; treating delete as no-op`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Fetch the live tag list (tags()) instead of caching tag names across runs.","Treat missing-tag deletes as idempotent no-ops in automation.","Normalize casing/whitespace of tag names at creation time to avoid mismatches."],"tags":["tag-management","missing-resource","validation"],"backgroundTag":"tag-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}