eyaltoledano/claude-task-master · error · Error
Tag ${oldTag} not found - file doesn't exist
Error message
Tag ${oldTag} not found - file doesn't exist What it means
FileStorage.renameTag throws this when the underlying tasks file for the tag being renamed does not exist on disk (an ENOENT from file read/write operations, re-thrown as a descriptive error). The library cannot rename a tag whose tasks file is missing.
Source
Thrown at packages/tm-core/src/modules/storage/adapters/file-storage/file-storage.ts:790
}
} else if (oldTag === 'master') {
// Convert standard format to legacy when renaming master
const masterTasks = existingData.tasks || [];
const masterMetadata = existingData.metadata || {};
return {
[newTag]: {
tasks: masterTasks,
metadata: { ...masterMetadata, tags: [newTag] }
}
};
} else {
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);
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Verify the tag exists first with listTags or getTasks(oldTag) before renaming
- Correct the tag name spelling in the renameTag call
- Create the tag first (createTag or saveTasks with the tag) if it should exist
- Run project initialization so the tasks file exists
Example fix
// before
await storage.renameTag('backlog', 'todo');
// after
const tags = await storage.listTags();
if (!tags.includes('backlog')) throw new Error(`Tag 'backlog' does not exist`);
await storage.renameTag('backlog', 'todo'); Defensive patterns
Strategy: validation
Validate before calling
const tags = await storage.listTags();
if (!tags.includes(oldTag)) {
throw new Error(`renameTag aborted: tag '${oldTag}' does not exist`);
}
await storage.renameTag(oldTag, newTag); Try / catch
try {
await storage.renameTag(oldTag, newTag);
} catch (e) {
if (e instanceof TaskMasterError || /not found - file doesn't exist/.test(e.message)) {
// tag/file missing: surface actionable message
throw new Error(`Tag '${oldTag}' does not exist; create it first`);
}
throw e;
} Prevention
- Call listTags() before rename/copy operations to validate tag names
- Centralize tag names as constants instead of string literals
- Run project initialization before storage operations in scripts
- Handle ENOENT-derived errors explicitly when scripting tag renames
When it happens
Trigger: Calling renameTag(oldTag, newTag) when oldTag has no tasks.json data file (or the tasks file itself is absent), e.g. renaming a tag that was never created or was already renamed.
Common situations: Typo in the tag name passed to renameTag; renaming a tag deleted by another process; running renameTag before initializeProject created the tasks file; stale tag references after a manual file move.
Related errors
- Source tag ${sourceTag} not found or has no tasks
- NOT_FOUND
- Tag "${targetTag}" not found.
- NOT_FOUND
- branch does not exist: ${branchName}
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/efc4772acf1e7e27.
Report an issue: GitHub.