eyaltoledano/claude-task-master · error
Failed to initialize services: ${(error as Error).message}
Error message
Failed to initialize services: ${(error as Error).message} What it means
copyTag checks the raw tagged data for a key matching sourceName and throws if absent, since there is nothing to copy. Tags are top-level keys in the tagged tasks data, so an unknown name simply doesn't exist.
Source
Thrown at apps/cli/src/commands/export.command.ts:128
* Initialize the TmCore and PromptService
*/
private async initializeServices(): Promise<void> {
if (this.taskMasterCore) {
return;
}
try {
const projectRoot = getProjectRoot();
// Initialize TmCore
this.taskMasterCore = await createTmCore({
projectPath: projectRoot
});
// Initialize PromptService for upgrade prompts
this.promptService = new PromptService(projectRoot);
} catch (error) {
throw new Error(
`Failed to initialize services: ${(error as Error).message}`
);
}
}
/**
* Execute the export command
*/
private async executeExport(options?: any): Promise<void> {
try {
// Ensure user is authenticated (will prompt and trigger OAuth if not)
const authResult = await ensureAuthenticated({
actionName: 'export tasks to Hamster'
});
if (!authResult.authenticated) {
if (authResult.cancelled) {
this.lastResult = {View on GitHub (pinned to c0c98d367c)
Solutions
- Run `task-master tags` (or inspect data.tags) to list valid source tag names
- Fix the spelling/casing of sourceName to match the existing tag key
- Create the source tag first (createTag) before copying
Example fix
// before await copyTag(tasksPath, 'in-progres', 'done'); // after await copyTag(tasksPath, 'in-progress', 'done');
Defensive patterns
Strategy: validation
Validate before calling
const data = JSON.parse(fs.readFileSync(tasksPath, 'utf8'));
const tags = Object.keys(data.tags || data).filter(k => k !== 'tasks');
if (!tags.includes(sourceName)) throw new Error(`Unknown source tag: ${sourceName}. Available: ${tags.join(', ')}`); Try / catch
try {
await copyTag(tasksPath, source, target);
} catch (e) {
if (e.message.includes('does not exist')) {
throw new Error(`Tag "${source}" not found. Run 'task-master tags' to list valid tags.`);
}
throw e;
} Prevention
- List existing tags (task-master tags) before scripted copies
- Copy-paste tag names instead of retyping them
- Remember tag keys are case-sensitive
When it happens
Trigger: Calling copyTag with a sourceName that was never created, or with a typo/case mismatch against an existing tag key (keys are case-sensitive).
Common situations: Listing tags with `task-master tags` and misspelling the name; referencing a tag deleted earlier or existing only in another project's tasks.json.
Related errors
- MFA_VERIFICATION_FAILED
- Invalid format: ${options.format}. Valid formats are: text,
- 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/1ed0f234842f5299.
Report an issue: GitHub.