eyaltoledano/claude-task-master · error · Error

Source tag ${sourceTag} not found or has no tasks

Error message

Source tag ${sourceTag} not found or has no tasks

What it means

FileStorage.copyTag throws this when loading the source tag yields zero tasks, meaning either the source tag does not exist in the tasks.json file or it exists but contains no task entries. The library refuses to copy an empty/missing tag to a target.

Source

Thrown at packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts:803

					throw new Error(`Tag ${oldTag} not found in standard format`);
				}
			});
		} catch (error: any) {
			if (error.code === 'ENOENT') {
				throw new Error(`Tag ${oldTag} not found - file doesn't exist`);
			}
			throw error;
		}
	}

	/**
	 * Copy a tag within the single tasks.json file
	 */
	async copyTag(sourceTag: string, targetTag: string): Promise<void> {
		const tasks = await this.loadTasks(sourceTag);

		if (tasks.length === 0) {
			throw new Error(`Source tag ${sourceTag} not found or has no tasks`);
		}

		await this.saveTasks(tasks, targetTag);
	}

	/**
	 * Get all tags with detailed statistics including task counts
	 * For file storage, reads tags from tasks.json and calculates statistics
	 */
	async getTagsWithStats(): Promise<{
		tags: Array<{
			name: string;
			isCurrent: boolean;
			taskCount: number;
			completedTasks: number;
			statusBreakdown: Record<string, number>;
			subtaskCounts?: {
				totalSubtasks: number;

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Check the source tag exists and has tasks via getTasks(sourceTag) before copying
  2. Fix the source tag name spelling
  3. Create/populate the source tag with tasks first
  4. If copying an empty tag is intentional, save tasks to targetTag directly instead of copyTag

Example fix

// before
await storage.copyTag('v1', 'v1-backup');
// after
const tasks = await storage.getTasks('v1');
if (tasks.length === 0) throw new Error('Nothing to copy: tag v1 has no tasks');
await storage.copyTag('v1', 'v1-backup');
Defensive patterns

Strategy: validation

Validate before calling

const tasks = await storage.getTasks(sourceTag);
if (tasks.length === 0) {
  throw new Error(`copyTag aborted: '${sourceTag}' missing or empty`);
}
await storage.copyTag(sourceTag, targetTag);

Try / catch

try {
  await storage.copyTag(sourceTag, targetTag);
} catch (e) {
  if (/Source tag .* not found or has no tasks/.test(e.message)) {
    console.warn(`Nothing to copy from '${sourceTag}'`);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling copyTag(sourceTag, targetTag) where sourceTag has no tasks in tasks.json — either the tag key is absent or it maps to an empty task list.

Common situations: Copying from a tag with a typo; copying a freshly created empty tag; source tag removed by a concurrent edit; running copyTag against the wrong project directory.

Related errors


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