eyaltoledano/claude-task-master · error

MISSING_ACCOUNT

MISSING_ACCOUNT

Error message

No organization selected. Please run "tm auth" and select an organization first.

What it means

callGenerateBriefEndpoint builds the Hamster API request body using request.orgId as accountId; if it is falsy it returns a MISSING_ACCOUNT failure result. Despite passing earlier org checks, the orgId was lost between resolution and the request-construction step, so the endpoint cannot be called.

Source

Thrown at packages/tm-core/src/modules/integration/services/export.service.ts:1069

		const apiUrl = `${apiBaseUrl}/ai/api/v1/briefs/generate-from-tasks`;

		// Get auth token
		const accessToken = await this.authManager.getAccessToken();
		if (!accessToken) {
			throw new TaskMasterError(
				'Not authenticated',
				ERROR_CODES.AUTHENTICATION_ERROR
			);
		}

		// Build request body - use accountId for Hamster API
		const accountId = request.orgId;
		if (!accountId) {
			return {
				success: false,
				error: {
					code: 'MISSING_ACCOUNT',
					message:
						'No organization selected. Please run "tm auth" and select an organization first.'
				}
			};
		}

		const requestBody: Record<string, unknown> = {
			tasks: request.tasks,
			source: request.source,
			accountId, // Hamster expects accountId, not orgId
			options: {
				generateTitle: request.options?.generateTitle ?? true,
				generateDescription: request.options?.generateDescription ?? true,
				preserveHierarchy: request.options?.preserveHierarchy ?? true,
				preserveDependencies: request.options?.preserveDependencies ?? true,
				title: request.options?.title,
				description: request.options?.description
			}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run `tm auth` and select an organization so the context stores an orgId.
  2. Pass orgId explicitly in the options so request.orgId is populated.
  3. Verify the earlier NO_ORGANIZATIONS branch actually assigned orgId before the endpoint call.
  4. Check that your auth context file wasn't wiped (re-authenticate).

Example fix

// before
await exportService.generateBriefFromTasks({ title: 'x' }); // no org selected
// after
await tmCore.auth.selectOrganization('org_123');
await exportService.generateBriefFromTasks({ title: 'x' });
Defensive patterns

Strategy: validation

Validate before calling

const ctx = await tmCore.auth.getContext();
if (!ctx?.orgId) throw new Error('Select an organization via tm auth first');

Type guard

function hasAccount(r: GenerateBriefRequest): r is GenerateBriefRequest & { orgId: string } {
  return typeof r.orgId === 'string' && r.orgId.trim().length > 0;
}

Try / catch

const result = await exportService.generateBriefFromTasks(opts);
if (!result.success && result.error?.code === 'MISSING_ACCOUNT') {
  console.error('Run tm auth and select an organization, then retry');
}

Prevention

When it happens

Trigger: generateBriefFromTasks resolves tasks and title but request.orgId ends up undefined when reaching callGenerateBriefEndpoint - i.e., org resolution was skipped or produced no value and no code path rejected it earlier.

Common situations: Programmatic callers constructing the internal request object directly without an orgId, or flows where context.orgId is unset and organization lookup was bypassed.

Related errors


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