eyaltoledano/claude-task-master · error · TaskMasterError

CONFIG_ERROR

CONFIG_ERROR

Error message

'No organization selected. Run "tm context org" first.'

What it means

resolveBrief in BriefsDomain requires an organization ID to fetch briefs. It tries explicit inputs first, then falls back to the auth manager's context orgId; if neither exists it throws TaskMasterError with code CONFIG_ERROR telling the user to run 'tm context org'. It is a configuration/state error, not a network failure.

Source

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

					(org) =>
						org.slug?.toLowerCase() === parsed.orgSlug?.toLowerCase() ||
						org.name.toLowerCase() === parsed.orgSlug?.toLowerCase()
				);
				if (matchingOrg) {
					resolvedOrgId = matchingOrg.id;
				}
			} catch {
				// If we can't fetch orgs, fall through to context
			}
		}

		// Fall back to context if still not resolved
		if (!resolvedOrgId) {
			resolvedOrgId = this.authManager.getContext()?.orgId;
		}

		if (!resolvedOrgId) {
			throw new TaskMasterError(
				'No organization selected. Run "tm context org" first.',
				ERROR_CODES.CONFIG_ERROR
			);
		}

		// Fetch all briefs for the org
		const briefs = await this.authManager.getBriefs(resolvedOrgId);

		// Find matching brief using service
		const matchingBrief = await this.briefService.findBrief(
			briefs,
			briefIdOrName
		);

		this.briefService.validateBriefFound(matchingBrief, briefIdOrName);

		return matchingBrief;
	}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Run `tm context org` to select the organization, then retry the command
  2. Run `tm auth login` first if there is no session at all, then set context
  3. Pass the organization explicitly if the calling API accepts an org ID parameter
  4. In scripts/CI, provision context non-interactively before invoking brief operations

Example fix

// before
await tmCore.briefs.resolveBrief('my-brief'); // throws CONFIG_ERROR
// after
if (!tmCore.auth.getContext()?.orgId) {
  await tmCore.context.setOrg('my-org'); // or shell out: tm context org
}
await tmCore.briefs.resolveBrief('my-brief');
Defensive patterns

Strategy: validation

Validate before calling

const ctx = tmCore.auth.getContext();
if (!ctx?.orgId) {
  throw new Error('No org selected — run `tm context org` or set context before brief operations');
}

Type guard

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

Try / catch

try {
  brief = await tmCore.briefs.resolveBrief(nameOrId);
} catch (e) {
  if (e instanceof TaskMasterError && e.code === 'CONFIG_ERROR') {
    await tmCore.context.setOrg(orgId); // then retry once
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling resolveBrief (or any flow that uses it, e.g. matchingBrief) before the user has logged in / selected an organization, so neither the input nor authManager.getContext()?.orgId yields an org ID.

Common situations: Fresh install where the user never ran 'tm context org'; stale/expired session clearing context; running brief commands in CI without provisioning context; switching machines without migrating config.

Related errors


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