eyaltoledano/claude-task-master · error · TaskMasterError

MISSING_CONFIGURATION

MISSING_CONFIGURATION

Error message

'No organization context available'

What it means

getBriefsWithStats requires an organization ID from the auth context to compute per-tag brief statistics. When authManager.getContext() is null or has no orgId, it throws TaskMasterError with code MISSING_CONFIGURATION and a userMessage directing the user to 'tm auth login'. Details include the operation name for diagnostics.

Source

Thrown at packages/tm-core/src/modules/briefs/briefs-domain.ts:126

		});
	}

	/**
	 * Get all briefs with detailed statistics including task counts
	 * Used for API storage to show brief statistics
	 */
	async getBriefsWithStats(
		repository: TaskRepository,
		projectId: string
	): Promise<{
		tags: TagWithStats[];
		currentTag: string | null;
		totalTags: number;
	}> {
		const context = this.authManager.getContext();

		if (!context?.orgId) {
			throw new TaskMasterError(
				'No organization context available',
				ERROR_CODES.MISSING_CONFIGURATION,
				{
					operation: 'getBriefsWithStats',
					userMessage:
						'No organization selected. Please authenticate first using: tm auth login'
				}
			);
		}

		// Get all briefs for the organization (through auth manager)
		const briefs = await this.authManager.getBriefs(context.orgId);

		// Use BriefService to calculate stats
		return this.briefService.getTagsWithStats(
			briefs,
			context.briefId,
			repository,

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run `tm auth login` to authenticate and establish organization context
  2. After login, run `tm context org` if the org still is not selected
  3. In automation, perform non-interactive auth (API key/env token) before calling
  4. Check the error's userMessage/details — it explicitly names the operation that needed context

Example fix

// before
const stats = await tmCore.briefs.getBriefsWithStats(); // throws MISSING_CONFIGURATION
// after
const ctx = tmCore.auth.getContext();
if (!ctx?.orgId) {
  await tmCore.auth.login(credentials); // establishes context
}
const stats = await tmCore.briefs.getBriefsWithStats();
Defensive patterns

Strategy: validation

Validate before calling

const ctx = tmCore.auth.getContext();
if (!ctx?.orgId) {
  await tmCore.auth.login(credentials); // authenticate first
}
// now safe to call getBriefsWithStats

Type guard

function isAuthenticatedWithOrg(ctx: AuthContext | null | undefined): ctx is AuthContext & { orgId: string } {
  return !!ctx && typeof ctx.orgId === 'string' && ctx.orgId.length > 0;
}

Try / catch

try {
  stats = await tmCore.briefs.getBriefsWithStats();
} catch (e) {
  if (e instanceof TaskMasterError && e.code === 'MISSING_CONFIGURATION') {
    await runTmAuthLogin(); // e.details.userMessage says: tm auth login
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling getBriefsWithStats (e.g. via getTagsWithStats) when the user is not authenticated or the authenticated session has no organization selected, so context?.orgId is undefined.

Common situations: Running tag/stat commands before ever logging in; session tokens cleared by DECRYPTION_FAILED cleanup; CI environments lacking auth setup; context file deleted or corrupted.

Related errors


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