{"record":{"id":"4d48c15c16c43719","repo":"eyaltoledano/claude-task-master","slug":"no-brief-selected","errorCode":"NO_BRIEF_SELECTED","errorMessage":"No brief selected","messagePattern":"No brief selected","errorType":"error_code","errorClass":"TaskMasterError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/auth/managers/auth-manager.ts","lineNumber":371,"sourceCode":"\t/**\n\t * Get all tasks for a specific brief\n\t */\n\tasync getTasks(briefId: string): Promise<RemoteTask[]> {\n\t\tconst service = await this.getOrganizationService();\n\t\treturn service.getTasks(briefId);\n\t}\n\n\t/**\n\t * Ensure a brief is selected in the current context\n\t * Throws a TaskMasterError if no brief is selected\n\t * @param operation - The operation name for error context\n\t * @returns The current user context with a guaranteed briefId\n\t */\n\tensureBriefSelected(operation: string): UserContextWithBrief {\n\t\tconst context = this.getContext();\n\n\t\tif (!context?.briefId) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'No brief selected',\n\t\t\t\tERROR_CODES.NO_BRIEF_SELECTED,\n\t\t\t\t{\n\t\t\t\t\toperation,\n\t\t\t\t\tuserMessage:\n\t\t\t\t\t\t'No brief selected. Please select a brief first using: tm context brief <brief-id> or tm context brief <brief-url>'\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\treturn context as UserContextWithBrief;\n\t}\n}\n","sourceCodeStart":353,"sourceCodeEnd":385,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/auth/managers/auth-manager.ts#L353-L385","documentation":"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>`.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst task = await tmCore.tasks.get('5'); // throws NO_BRIEF_SELECTED\n// after\nconst ctx = tmCore.auth.getContext();\nif (!ctx?.briefId) await tmCore.auth.updateContext({ briefId: 'br_123' });\nconst task = await tmCore.tasks.get('5');","handlingStrategy":"validation","validationCode":"const ctx = tmCore.auth.getContext();\nif (!ctx?.briefId) {\n  const briefId = await promptBriefSelection();\n  await tmCore.auth.updateContext({ briefId });\n}","typeGuard":"function hasBriefSelected(ctx: unknown): ctx is UserContextWithBrief {\n  return !!ctx && typeof (ctx as UserContext).briefId === 'string' && (ctx as UserContext).briefId.length > 0;\n}","tryCatchPattern":"try {\n  const task = await tmCore.tasks.get(taskId);\n} catch (e) {\n  if (e instanceof TaskMasterError && e.code === ERROR_CODES.NO_BRIEF_SELECTED) {\n    const briefId = await promptBriefSelection();\n    await tmCore.auth.updateContext({ briefId });\n    // retry the operation\n  } else throw e;\n}","preventionTips":["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"],"tags":["context","brief","configuration"],"backgroundTag":"no-brief-selected","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}