eyaltoledano/claude-task-master · error
Invalid format: ${options.format}. Valid formats are: text,
Error message
Invalid format: ${options.format}. Valid formats are: text, json What it means
copyTag enforces that the target tag key is not already present in the tagged data, since tags are object keys and copying into an existing tag would overwrite its tasks. Throwing prevents silent data loss.
Source
Thrown at apps/cli/src/commands/generate.command.ts:95
this.displayResults(result, options);
} catch (error: any) {
hasError = true;
displayError(error, { skipExit: true });
} finally {
await this.cleanup();
}
if (hasError) {
process.exit(1);
}
}
/**
* Validate command options
*/
private validateOptions(options: GenerateCommandOptions): void {
if (options.format && !['text', 'json'].includes(options.format)) {
throw new Error(
`Invalid format: ${options.format}. Valid formats are: text, json`
);
}
}
/**
* Initialize TmCore
*/
private async initializeCore(projectRoot: string): Promise<void> {
if (!this.tmCore) {
const resolved = path.resolve(projectRoot);
this.tmCore = await createTmCore({ projectPath: resolved });
}
}
/**
* Generate task files using tm-core
*/View on GitHub (pinned to c0c98d367c)
Solutions
- Choose a unique target tag name
- Delete or rename the existing target tag first if its contents are disposable
- Add an existence guard (task-master tags) in scripts before calling copyTag
Example fix
// before await copyTag(tasksPath, 'backlog', 'sprint-1'); // sprint-1 exists // after if (!tagsData['sprint-1']) await copyTag(tasksPath, 'backlog', 'sprint-1');
Defensive patterns
Strategy: validation
Validate before calling
const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
if (data[targetName] || (data.tags && data.tags[targetName])) {
throw new Error(`Target tag already exists: ${targetName}`);
} Try / catch
try {
await copyTag(tasksPath, source, target);
} catch (e) {
if (e.message.includes('already exists')) {
const unique = `${target}-${Date.now()}`;
return copyTag(tasksPath, source, unique);
}
throw e;
} Prevention
- Make copy-tag scripts idempotent with existence checks
- Use unique, timestamped names for backup-style tags
- Clean up old tags before re-running automation
When it happens
Trigger: Calling copyTag with a targetName that already exists in tasks.json, including re-running the same copy-tag command twice.
Common situations: Idempotent automation scripts re-executing copy-tag; picking a target name that duplicates an existing tag; forgetting a previous copy operation already succeeded.
Related errors
- MFA_VERIFICATION_FAILED
- Failed to initialize services: ${(error as Error).message}
- Failed to fetch tasks from any tag. First error: ${failedTag
- ${authCheck.error}
- VALIDATION_ERROR
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/30ea5cd9e91402b3.
Report an issue: GitHub.