{"record":{"id":"286aceda59436681","repo":"eyaltoledano/claude-task-master","slug":"missing-configuration","errorCode":"MISSING_CONFIGURATION","errorMessage":"'No organization context available'","messagePattern":"'No organization context available'","errorType":"exception","errorClass":"TaskMasterError","httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/briefs/briefs-domain.ts","lineNumber":126,"sourceCode":"\t\t});\n\t}\n\n\t/**\n\t * Get all briefs with detailed statistics including task counts\n\t * Used for API storage to show brief statistics\n\t */\n\tasync getBriefsWithStats(\n\t\trepository: TaskRepository,\n\t\tprojectId: string\n\t): Promise<{\n\t\ttags: TagWithStats[];\n\t\tcurrentTag: string | null;\n\t\ttotalTags: number;\n\t}> {\n\t\tconst context = this.authManager.getContext();\n\n\t\tif (!context?.orgId) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'No organization context available',\n\t\t\t\tERROR_CODES.MISSING_CONFIGURATION,\n\t\t\t\t{\n\t\t\t\t\toperation: 'getBriefsWithStats',\n\t\t\t\t\tuserMessage:\n\t\t\t\t\t\t'No organization selected. Please authenticate first using: tm auth login'\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\t// Get all briefs for the organization (through auth manager)\n\t\tconst briefs = await this.authManager.getBriefs(context.orgId);\n\n\t\t// Use BriefService to calculate stats\n\t\treturn this.briefService.getTagsWithStats(\n\t\t\tbriefs,\n\t\t\tcontext.briefId,\n\t\t\trepository,","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/briefs/briefs-domain.ts#L108-L144","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `tm auth login` to authenticate and establish organization context","After login, run `tm context org` if the org still is not selected","In automation, perform non-interactive auth (API key/env token) before calling","Check the error's userMessage/details — it explicitly names the operation that needed context"],"exampleFix":"// before\nconst stats = await tmCore.briefs.getBriefsWithStats(); // throws MISSING_CONFIGURATION\n// after\nconst ctx = tmCore.auth.getContext();\nif (!ctx?.orgId) {\n  await tmCore.auth.login(credentials); // establishes context\n}\nconst stats = await tmCore.briefs.getBriefsWithStats();","handlingStrategy":"validation","validationCode":"const ctx = tmCore.auth.getContext();\nif (!ctx?.orgId) {\n  await tmCore.auth.login(credentials); // authenticate first\n}\n// now safe to call getBriefsWithStats","typeGuard":"function isAuthenticatedWithOrg(ctx: AuthContext | null | undefined): ctx is AuthContext & { orgId: string } {\n  return !!ctx && typeof ctx.orgId === 'string' && ctx.orgId.length > 0;\n}","tryCatchPattern":"try {\n  stats = await tmCore.briefs.getBriefsWithStats();\n} catch (e) {\n  if (e instanceof TaskMasterError && e.code === 'MISSING_CONFIGURATION') {\n    await runTmAuthLogin(); // e.details.userMessage says: tm auth login\n  } else { throw e; }\n}","preventionTips":["Gate stats/tag commands behind an auth check (`tm auth whoami` equivalent)","Never delete context files while sessions depend on them; re-login after credential cleanup","In automation, provision auth (API key or login step) before any briefs-domain calls","Surface the error's userMessage to end users — it already states the exact remedy"],"tags":["config","auth","organization","context"],"backgroundTag":"missing-org-context","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}