eyaltoledano/claude-task-master · critical · TaskMasterError

INTERNAL_ERROR

INTERNAL_ERROR

Error message

Failed to initialize TmCore

What it means

A wrapper error thrown when TmCore.initialize() fails for any internal reason (dependency construction, service wiring, config loading, etc.). The original error is attached as the `cause` and the failure is logged via the configured logger, so the outer TaskMasterError (code INTERNAL_ERROR) is generic while the root cause lives on the error object.

Source

Thrown at packages/tm-core/src/tm-core.ts:201

			this._integration = new IntegrationDomain(this._configManager);
			this._loop = new LoopDomain(this._configManager);

			// Initialize domains that need async setup
			await this._tasks.initialize();

			// Wire up cross-domain dependencies
			// WorkflowDomain needs TasksDomain for status updates
			this._workflow.setTasksDomain(this._tasks);

			// Log successful initialization
			this._logger.info('TmCore initialized successfully');
		} catch (error) {
			// Log error if logger is available
			if (this._logger) {
				this._logger.error('Failed to initialize TmCore:', error);
			}

			throw new TaskMasterError(
				'Failed to initialize TmCore',
				ERROR_CODES.INTERNAL_ERROR,
				{ operation: 'initialize' },
				error as Error
			);
		}
	}

	/**
	 * Get project root path
	 */
	get projectPath(): string {
		return this._projectPath;
	}

	/**
	 * Close and cleanup resources
	 * Releases file locks and other storage resources

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Inspect error.cause (the 4th TaskMasterError arg) and the logger output ('Failed to initialize TmCore:') for the real root cause.
  2. Verify the project directory and its Task Master config files are readable and valid.
  3. Check that any custom options/adapters passed to TmCore.create() are valid instances.
  4. Reproduce with a minimal TmCore.create({ projectPath }) call to isolate the failing subsystem, then upgrade or file an issue if it's a library bug.

Example fix

// before
try { const tm = await TmCore.create(opts); } catch (e) { console.log(e.message); } // generic only
// after
try { const tm = await TmCore.create(opts); }
catch (e) {
  console.error(e.message, e.cause ?? e); // root cause of init failure
}
Defensive patterns

Strategy: try-catch

Try / catch

import { TaskMasterError } from '@tm/core';
try {
  const tmCore = await TmCore.create({ projectPath });
} catch (e) {
  if (e instanceof TaskMasterError && e.code === 'INTERNAL_ERROR') {
    console.error('TmCore init failed:', e.cause ?? e); // surface root cause
  } else throw e;
}

Prevention

When it happens

Trigger: Any exception inside initialize()'s try block — e.g. a domain service constructor throws, config files are unreadable, or a module dependency fails to instantiate during TmCore.create().

Common situations: Corrupt or missing project config, filesystem permission problems, a broken custom adapter/service injected via options, or bugs in a newly upgraded tm-core version.

Related errors


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