eyaltoledano/claude-task-master · error · TaskMasterError

MISSING_CONFIGURATION

MISSING_CONFIGURATION

Error message

API storage not fully configured (${missing.join(', ') || 'credentials missing'}). Run: tm auth login, or set the missing field(s).

What it means

StorageFactory.create throws a TaskMasterError with code MISSING_CONFIGURATION when storage type 'api' is requested but no API access token is configured and AuthManager has no valid session. API-backed storage cannot authenticate without either an explicit apiAccessToken or a logged-in session.

Source

Thrown at packages/tm-core/src/modules/storage/services/storage-factory.ts:73

		const logger = getLogger('StorageFactory');

		switch (storageType) {
			case 'file':
				logger.debug('📁 Using local file storage');
				return StorageFactory.createFileStorage(projectPath, config);

			case 'api':
				if (!StorageFactory.isHamsterAvailable(config)) {
					const missing: string[] = [];
					if (!config.storage?.apiEndpoint) missing.push('apiEndpoint');
					if (!config.storage?.apiAccessToken) missing.push('apiAccessToken');

					// Check if authenticated via AuthManager
					const authManager = AuthManager.getInstance();
					const hasSession = await authManager.hasValidSession();
					if (!hasSession) {
						throw new TaskMasterError(
							`API storage not fully configured (${missing.join(', ') || 'credentials missing'}). Run: tm auth login, or set the missing field(s).`,
							ERROR_CODES.MISSING_CONFIGURATION,
							{ storageType: 'api', missing }
						);
					}
					// Use auth token from AuthManager
					const accessToken = await authManager.getAccessToken();
					if (accessToken) {
						// Merge with existing storage config, ensuring required fields
						const nextStorage: StorageSettings = {
							...(config.storage as StorageSettings),
							type: 'api',
							apiAccessToken: accessToken,
							apiEndpoint:
								config.storage?.apiEndpoint ||
								process.env.TM_BASE_DOMAIN ||
								process.env.TM_PUBLIC_BASE_DOMAIN ||
								'https://tryhamster.com/api'

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run `tm auth login` to establish a valid session before creating API storage
  2. Set storage.apiAccessToken in the storage config to a valid token
  3. Fix the storage type in config if file storage was intended
  4. Verify the token/env var is present in CI (secret not injected)

Example fix

// before
const storage = await StorageFactory.createFromStorageConfig({ storageType: 'api' });
// after
const authManager = AuthManager.getInstance();
if (!await authManager.hasValidSession()) {
  throw new Error('Run: tm auth login before using API storage');
}
const storage = await StorageFactory.createFromStorageConfig({ storageType: 'api' });
Defensive patterns

Strategy: validation

Validate before calling

const authManager = AuthManager.getInstance();
const hasSession = await authManager.hasValidSession();
const hasToken = Boolean(config.storage?.apiAccessToken);
if (!hasSession && !hasToken) {
  throw new Error('API storage requires `tm auth login` or storage.apiAccessToken');
}
const storage = await StorageFactory.createFromStorageConfig(config);

Try / catch

try {
  const storage = await StorageFactory.createFromStorageConfig(config);
} catch (e) {
  if (e instanceof TaskMasterError && e.code === ERROR_CODES.MISSING_CONFIGURATION) {
    console.error('API storage not configured:', e.details?.missing);
    console.error('Fix: run `tm auth login` or set storage.apiAccessToken');
  }
  throw e;
}

Prevention

When it happens

Trigger: Creating API storage via createFromStorageConfig when config.storage.apiAccessToken is unset AND AuthManager.hasValidSession() returns false — i.e. never ran `tm auth login` and no token in config/env.

Common situations: Fresh machine or CI environment without `tm auth login`; expired/invalidated session; misconfigured storage type set to 'api' when intending file storage; token field name typo in config.

Related errors


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