{"record":{"id":"951e5c49ac435ad8","repo":"eyaltoledano/claude-task-master","slug":"missing-account","errorCode":"MISSING_ACCOUNT","errorMessage":"No organization selected. Please run \"tm auth\" and select an organization first.","messagePattern":"No organization selected\\. Please run \"tm auth\" and select an organization first\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/services/export.service.ts","lineNumber":1069,"sourceCode":"\n\t\tconst apiUrl = `${apiBaseUrl}/ai/api/v1/briefs/generate-from-tasks`;\n\n\t\t// Get auth token\n\t\tconst accessToken = await this.authManager.getAccessToken();\n\t\tif (!accessToken) {\n\t\t\tthrow new TaskMasterError(\n\t\t\t\t'Not authenticated',\n\t\t\t\tERROR_CODES.AUTHENTICATION_ERROR\n\t\t\t);\n\t\t}\n\n\t\t// Build request body - use accountId for Hamster API\n\t\tconst accountId = request.orgId;\n\t\tif (!accountId) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'MISSING_ACCOUNT',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'No organization selected. Please run \"tm auth\" and select an organization first.'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tconst requestBody: Record<string, unknown> = {\n\t\t\ttasks: request.tasks,\n\t\t\tsource: request.source,\n\t\t\taccountId, // Hamster expects accountId, not orgId\n\t\t\toptions: {\n\t\t\t\tgenerateTitle: request.options?.generateTitle ?? true,\n\t\t\t\tgenerateDescription: request.options?.generateDescription ?? true,\n\t\t\t\tpreserveHierarchy: request.options?.preserveHierarchy ?? true,\n\t\t\t\tpreserveDependencies: request.options?.preserveDependencies ?? true,\n\t\t\t\ttitle: request.options?.title,\n\t\t\t\tdescription: request.options?.description\n\t\t\t}","sourceCodeStart":1051,"sourceCodeEnd":1087,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/services/export.service.ts#L1051-L1087","documentation":"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.","triggerScenarios":"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.","commonSituations":"Programmatic callers constructing the internal request object directly without an orgId, or flows where context.orgId is unset and organization lookup was bypassed.","solutions":["Run `tm auth` and select an organization so the context stores an orgId.","Pass orgId explicitly in the options so request.orgId is populated.","Verify the earlier NO_ORGANIZATIONS branch actually assigned orgId before the endpoint call.","Check that your auth context file wasn't wiped (re-authenticate)."],"exampleFix":"// before\nawait exportService.generateBriefFromTasks({ title: 'x' }); // no org selected\n// after\nawait tmCore.auth.selectOrganization('org_123');\nawait exportService.generateBriefFromTasks({ title: 'x' });","handlingStrategy":"validation","validationCode":"const ctx = await tmCore.auth.getContext();\nif (!ctx?.orgId) throw new Error('Select an organization via tm auth first');","typeGuard":"function hasAccount(r: GenerateBriefRequest): r is GenerateBriefRequest & { orgId: string } {\n  return typeof r.orgId === 'string' && r.orgId.trim().length > 0;\n}","tryCatchPattern":"const result = await exportService.generateBriefFromTasks(opts);\nif (!result.success && result.error?.code === 'MISSING_ACCOUNT') {\n  console.error('Run tm auth and select an organization, then retry');\n}","preventionTips":["Complete organization selection during `tm auth` setup","Pass orgId explicitly in options for scripted/CI usage","Assert auth context includes orgId at workflow start"],"tags":["organization","auth","configuration","brief"],"backgroundTag":"missing-org-context","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}