{"record":{"id":"393a2b4d466c1c83","repo":"eyaltoledano/claude-task-master","slug":"auth-required","errorCode":"AUTH_REQUIRED","errorMessage":"Authentication required","messagePattern":"Authentication required","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tm-core/src/modules/integration/services/export.service.ts","lineNumber":1354,"sourceCode":"\t\t\t\t\tmessage: `Failed to connect to API: ${errorMessage}`\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}\n\n\t// ========== Brief Status Polling ==========\n\n\t/**\n\t * Get the current status of a brief's task generation\n\t * Used to poll progress after generateBriefFromPrd\n\t */\n\tasync getBriefStatus(briefId: string): Promise<BriefStatusResult> {\n\t\tconst isAuthenticated = await this.authManager.hasValidSession();\n\t\tif (!isAuthenticated) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'AUTH_REQUIRED',\n\t\t\t\t\tmessage: 'Authentication required'\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t// Get API URL\n\t\tconst authDomain = new AuthDomain();\n\t\tconst apiBaseUrl = authDomain.getApiBaseUrl();\n\n\t\tif (!apiBaseUrl) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'MISSING_CONFIGURATION',\n\t\t\t\t\tmessage: 'API endpoint not configured'\n\t\t\t\t}\n\t\t\t};\n\t\t}","sourceCodeStart":1336,"sourceCodeEnd":1372,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/integration/services/export.service.ts#L1336-L1372","documentation":"getBriefStatus() first checks authManager.hasValidSession(); if there is no valid authenticated session, it short-circuits and returns a structured failure with code AUTH_REQUIRED and message 'Authentication required'. The API call is never attempted — this is a client-side preflight check, so the user needs to log in before polling brief status.","triggerScenarios":"Calling getBriefStatus(briefId) while logged out: no session exists, the stored session expired and is no longer valid, credentials were cleared from config, or the app is running in an environment without prior 'tm auth' login.","commonSituations":"Session token expired after idle time; CI/CD or fresh machine where authentication was never performed; user logged out in another terminal; corrupted or deleted local auth/config storage.","solutions":["Run the login flow (e.g. 'tm auth') to establish a valid session, then retry getBriefStatus.","Check hasValidSession() before calling and route the user to authentication if false.","If the session recently expired, re-authenticate — tokens are not auto-refreshed here.","Verify the auth config/storage location is intact and points at the expected profile."],"exampleFix":"// before\nconst res = await tmCore.integration.getBriefStatus(briefId); // fails when logged out\n// after: preflight the session\nif (!(await tmCore.auth.hasValidSession())) {\n  await tmCore.auth.login(); // or prompt the user to run 'tm auth'\n}\nconst res = await tmCore.integration.getBriefStatus(briefId);","handlingStrategy":"validation","validationCode":"if (!(await tmCore.auth.hasValidSession())) {\n  throw new Error('Not logged in. Run tm auth before polling brief status.');\n}","typeGuard":"function isAuthRequired(result: { success: boolean; error?: { code: string } }): boolean {\n  return !result.success && result.error?.code === 'AUTH_REQUIRED';\n}","tryCatchPattern":"const res = await tmCore.integration.getBriefStatus(briefId);\nif (!res.success && res.error?.code === 'AUTH_REQUIRED') {\n  await tmCore.auth.login(); // re-authenticate then retry\n}","preventionTips":["Always check hasValidSession() before any authenticated API call","Run the login flow as part of environment/CI setup","Handle session expiry proactively (refresh or re-login on AUTH_REQUIRED)","Keep auth config/storage intact; avoid partial logout implementations"],"tags":["auth","authentication","session"],"backgroundTag":"authentication-required","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}