eyaltoledano/claude-task-master · error · Error

Tag ${oldTag} not found

Error message

Tag ${oldTag} not found

What it means

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.

Source

Thrown at packages/tm-core/src/modules/storage/adapters/api-storage.ts:780

			throw new TaskMasterError(
				'Failed to delete tag via API',
				ERROR_CODES.STORAGE_ERROR,
				{ operation: 'deleteTag', tag },
				error as Error
			);
		}
	}

	/**
	 * Rename a tag
	 */
	async renameTag(oldTag: string, newTag: string): Promise<void> {
		await this.ensureInitialized();

		try {
			const tagData = this.tagsCache.get(oldTag);
			if (!tagData) {
				throw new Error(`Tag ${oldTag} not found`);
			}

			// Create new tag with same data
			const newTagData = { ...tagData, name: newTag };
			await this.repository.createTag(this.projectId, newTagData);

			// Delete old tag
			await this.repository.deleteTag(this.projectId, oldTag);

			// Update cache
			this.tagsCache.delete(oldTag);
			this.tagsCache.set(newTag, newTagData);
		} catch (error) {
			throw new TaskMasterError(
				'Failed to rename tag via API',
				ERROR_CODES.STORAGE_ERROR,
				{ operation: 'renameTag', oldTag, newTag },
				error as Error

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Verify the tag exists via getTags/listTags and use the exact cached name.
  2. Call the method that loads the tags cache (or re-initialize storage) so tagsCache reflects the remote state before renaming.
  3. Fix the tag-name typo / confirm you are connected to the project that owns the tag.
  4. If the tag exists remotely but not in cache, treat it as a cache-sync bug: refresh the cache and retry.

Example fix

// before
await storage.renameTag('proirity', 'priority'); // typo, not in cache
// after
const tags = await storage.getTags();
if (!tags.some(t => t.name === 'proirity')) {
  throw new Error('Tag proirity does not exist; available: ' + tags.map(t => t.name).join(', '));
}
await storage.renameTag('proirity', 'priority');
Defensive patterns

Strategy: validation

Validate before calling

const tags = await storage.getTags();
if (!tags.some(t => t.name === oldTag)) {
  throw new Error(`Cannot rename: tag '${oldTag}' does not exist`);
}

Try / catch

try {
  await storage.renameTag(oldTag, newTag);
} catch (e) {
  if (String(e.cause ?? e.message).includes('not found')) {
    console.warn(`Tag '${oldTag}' not in cache; refresh tags and retry.`);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/83c68b4f958948b8. Report an issue: GitHub.