eyaltoledano/claude-task-master · error · Error
Source tag ${sourceTag} not found
Error message
Source tag ${sourceTag} not found What it means
A plain Error (later wrapped by 'Failed to copy tag via API') thrown by ApiStorage.copyTag when sourceTag is not present in the local tagsCache. The copy uses cached source data as the template, so a missing source tag aborts before any API call.
Source
Thrown at packages/tm-core/src/modules/storage/adapters/api-storage.ts:812
throw new TaskMasterError(
'Failed to rename tag via API',
ERROR_CODES.STORAGE_ERROR,
{ operation: 'renameTag', oldTag, newTag },
error as Error
);
}
}
/**
* Copy a tag
*/
async copyTag(sourceTag: string, targetTag: string): Promise<void> {
await this.ensureInitialized();
try {
const sourceData = this.tagsCache.get(sourceTag);
if (!sourceData) {
throw new Error(`Source tag ${sourceTag} not found`);
}
// Create new tag with copied data
const targetData = { ...sourceData, name: targetTag };
await this.repository.createTag(this.projectId, targetData);
// Update cache
this.tagsCache.set(targetTag, targetData);
} catch (error) {
throw new TaskMasterError(
'Failed to copy tag via API',
ERROR_CODES.STORAGE_ERROR,
{ operation: 'copyTag', sourceTag, targetTag },
error as Error
);
}
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Confirm the source tag exists via getTags and use the exact name.
- Refresh the tags cache (re-initialize storage or the cache-loading path) before copying.
- Correct the projectId/brief context so storage points at the project containing the source tag.
- Fix any tag-name casing or typo mismatch.
Example fix
// before
await storage.copyTag('in-progess', 'in-progress-copy'); // source typo
// after
const tags = await storage.getTags();
const src = tags.find(t => t.name === 'in-progess');
if (!src) throw new Error('Source tag missing; available: ' + tags.map(t => t.name).join(', '));
await storage.copyTag(src.name, 'in-progress-copy'); Defensive patterns
Strategy: validation
Validate before calling
const tags = await storage.getTags();
if (!tags.some(t => t.name === sourceTag)) {
throw new Error(`Cannot copy: source tag '${sourceTag}' does not exist`);
} Try / catch
try {
await storage.copyTag(sourceTag, targetTag);
} catch (e) {
if (String(e.cause ?? e.message).includes('not found')) {
console.warn(`Source tag '${sourceTag}' missing; refresh cache and verify name.`);
return;
}
throw e;
} Prevention
- List tags and pick the source by exact match before copying.
- Refresh the tags cache when the process runs longer than a typical session.
- Confirm the projectId/brief context matches the project that owns the source tag.
When it happens
Trigger: Calling storage.copyTag(sourceTag, targetTag) where sourceTag was never created in this session, the tagsCache was not loaded/refreshed, or the source tag exists only in another project/brief context.
Common situations: Copy-pasting a script between projects with different tag sets, typos in the source tag name, cache stale relative to remote (tag created elsewhere), or wrong projectId bound to the storage instance.
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
- Tag ${oldTag} not found
- Tag '${tag}' not found or has no tasks.
- NOT_FOUND
- branch does not exist: ${branchName}
- NOT_FOUND
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/984fdba88af49bfa.
Report an issue: GitHub.