eyaltoledano/claude-task-master · error · TaskMasterError
NO_BRIEF_SELECTED
NO_BRIEF_SELECTED
Error message
No brief selected
What it means
ensureBriefSelected returns a UserContextWithBrief guaranteed to contain a briefId. When the stored context has no brief selected it throws TaskMasterError with code NO_BRIEF_SELECTED and a userMessage telling the user to select a brief via `tm context brief <brief-id|brief-url>`.
Source
Thrown at packages/tm-core/src/modules/auth/managers/auth-manager.ts:371
/**
* Get all tasks for a specific brief
*/
async getTasks(briefId: string): Promise<RemoteTask[]> {
const service = await this.getOrganizationService();
return service.getTasks(briefId);
}
/**
* Ensure a brief is selected in the current context
* Throws a TaskMasterError if no brief is selected
* @param operation - The operation name for error context
* @returns The current user context with a guaranteed briefId
*/
ensureBriefSelected(operation: string): UserContextWithBrief {
const context = this.getContext();
if (!context?.briefId) {
throw new TaskMasterError(
'No brief selected',
ERROR_CODES.NO_BRIEF_SELECTED,
{
operation,
userMessage:
'No brief selected. Please select a brief first using: tm context brief <brief-id> or tm context brief <brief-url>'
}
);
}
return context as UserContextWithBrief;
}
}
View on GitHub (pinned to c0c98d367c)
Solutions
- Select a brief first: `tm context brief <brief-id>` or `tm context brief <brief-url>`
- Programmatically call authManager.updateContext({ briefId }) before task operations
- Catch TaskMasterError code NO_BRIEF_SELECTED and run the brief-selection prompt
- Check getContext()?.briefId before invoking brief-dependent operations
Example fix
// before
const task = await tmCore.tasks.get('5'); // throws NO_BRIEF_SELECTED
// after
const ctx = tmCore.auth.getContext();
if (!ctx?.briefId) await tmCore.auth.updateContext({ briefId: 'br_123' });
const task = await tmCore.tasks.get('5'); Defensive patterns
Strategy: validation
Validate before calling
const ctx = tmCore.auth.getContext();
if (!ctx?.briefId) {
const briefId = await promptBriefSelection();
await tmCore.auth.updateContext({ briefId });
} Type guard
function hasBriefSelected(ctx: unknown): ctx is UserContextWithBrief {
return !!ctx && typeof (ctx as UserContext).briefId === 'string' && (ctx as UserContext).briefId.length > 0;
} Try / catch
try {
const task = await tmCore.tasks.get(taskId);
} catch (e) {
if (e instanceof TaskMasterError && e.code === ERROR_CODES.NO_BRIEF_SELECTED) {
const briefId = await promptBriefSelection();
await tmCore.auth.updateContext({ briefId });
// retry the operation
} else throw e;
} Prevention
- After login, always complete the context setup: org then brief
- Check getContext()?.briefId before task operations
- Persist briefId in automation scripts rather than assuming prior selection
- Surface the userMessage from the error which documents the fix command
When it happens
Trigger: Calling task operations that require a brief (getTask, updateTaskStatus, the `context` accessor) when context?.briefId is undefined — i.e. authenticated and org selected, but no brief chosen.
Common situations: After login and org selection the user skipped brief selection; context was cleared; switching machines where the fresh context file lacks briefId; automations assuming a prior interactive selection.
Related errors
- NO_BRIEF_SELECTED
- NO_ORGANIZATIONS
- MISSING_ACCOUNT
- Model "${model}" is not available for provider "${this.getNa
- AUTHENTICATION_ERROR
AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29).
Data as JSON: /api/errors/4d48c15c16c43719.
Report an issue: GitHub.