{"record":{"id":"83c68b4f958948b8","repo":"eyaltoledano/claude-task-master","slug":"tag-oldtag-not-found","errorCode":null,"errorMessage":"Tag ${oldTag} not found","messagePattern":"Tag (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/storage/adapters/api-storage.ts","lineNumber":780,"sourceCode":"\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Failed to delete tag via API',\n\t\t\t\tERROR_CODES.STORAGE_ERROR,\n\t\t\t\t{ operation: 'deleteTag', tag },\n\t\t\t\terror as Error\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Rename a tag\n\t */\n\tasync renameTag(oldTag: string, newTag: string): Promise<void> {\n\t\tawait this.ensureInitialized();\n\n\t\ttry {\n\t\t\tconst tagData = this.tagsCache.get(oldTag);\n\t\t\tif (!tagData) {\n\t\t\t\tthrow new Error(`Tag ${oldTag} not found`);\n\t\t\t}\n\n\t\t\t// Create new tag with same data\n\t\t\tconst newTagData = { ...tagData, name: newTag };\n\t\t\tawait this.repository.createTag(this.projectId, newTagData);\n\n\t\t\t// Delete old tag\n\t\t\tawait this.repository.deleteTag(this.projectId, oldTag);\n\n\t\t\t// Update cache\n\t\t\tthis.tagsCache.delete(oldTag);\n\t\t\tthis.tagsCache.set(newTag, newTagData);\n\t\t} catch (error) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Failed to rename tag via API',\n\t\t\t\tERROR_CODES.STORAGE_ERROR,\n\t\t\t\t{ operation: 'renameTag', oldTag, newTag },\n\t\t\t\terror as Error","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/storage/adapters/api-storage.ts#L762-L798","documentation":"A plain Error (later wrapped by 'Failed to rename tag via API') thrown by ApiStorage.renameTag when oldTag is absent from the local tagsCache. Rename operates on cached tag data, so an unknown source tag aborts before any API call is made.","triggerScenarios":"Calling storage.renameTag(oldTag, newTag) where oldTag was never created in this session, the cache is not yet populated (loadTagsIntoCache failed or was skipped), or oldTag was renamed/deleted remotely so the cached name no longer exists.","commonSituations":"Renaming a tag created by another machine/user, typo in the old tag name, script run against the wrong projectId so the tag list differs, or cache populated before a teammate added the tag.","solutions":["Verify the tag exists via getTags/listTags and use the exact cached name.","Call the method that loads the tags cache (or re-initialize storage) so tagsCache reflects the remote state before renaming.","Fix the tag-name typo / confirm you are connected to the project that owns the tag.","If the tag exists remotely but not in cache, treat it as a cache-sync bug: refresh the cache and retry."],"exampleFix":"// before\nawait storage.renameTag('proirity', 'priority'); // typo, not in cache\n// after\nconst tags = await storage.getTags();\nif (!tags.some(t => t.name === 'proirity')) {\n  throw new Error('Tag proirity does not exist; available: ' + tags.map(t => t.name).join(', '));\n}\nawait storage.renameTag('proirity', 'priority');","handlingStrategy":"validation","validationCode":"const tags = await storage.getTags();\nif (!tags.some(t => t.name === oldTag)) {\n  throw new Error(`Cannot rename: tag '${oldTag}' does not exist`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await storage.renameTag(oldTag, newTag);\n} catch (e) {\n  if (String(e.cause ?? e.message).includes('not found')) {\n    console.warn(`Tag '${oldTag}' not in cache; refresh tags and retry.`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Always resolve tag names from getTags() instead of hardcoding them.","Refresh the tags cache before rename operations in long-running processes.","Validate user-supplied tag names against the cached tag list with fuzzy suggestions for typos."],"tags":["tag","not-found","cache","rename"],"backgroundTag":"resource-not-found","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}