{"record":{"id":"0832bf31cc6bd459","repo":"eyaltoledano/claude-task-master","slug":"legacy-auth-json-found-but-no-valid-supabase-sessi","errorCode":null,"errorMessage":"Legacy auth.json found but no valid Supabase session.","messagePattern":"Legacy auth\\.json found but no valid Supabase session\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/tm-core/src/modules/auth/services/session-manager.ts","lineNumber":91,"sourceCode":"\t * Migrate legacy auth.json to Supabase session\n\t * Called once during SessionManager initialization\n\t */\n\tprivate async migrateLegacyAuth(): Promise<void> {\n\t\tif (!fs.existsSync(this.LEGACY_AUTH_FILE)) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Check if we have a valid Supabase session (don't use hasValidSession to avoid circular wait)\n\t\t\tconst session = await this.supabaseClient.getSession();\n\t\t\tif (session) {\n\t\t\t\tfs.unlinkSync(this.LEGACY_AUTH_FILE);\n\t\t\t\tthis.logger.info('Migrated to Supabase auth, removed legacy auth.json');\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Otherwise, user needs to re-authenticate\n\t\t\tthis.logger.warn('Legacy auth.json found but no valid Supabase session.');\n\t\t\tthis.logger.warn('Please run: task-master auth login');\n\t\t} catch (error) {\n\t\t\tthis.logger.debug('Error during legacy auth migration:', error);\n\t\t}\n\t}\n\n\t// ========== Session State ==========\n\n\t/**\n\t * Check if valid Supabase session exists\n\t * @returns true if a valid session exists\n\t */\n\tasync hasValidSession(): Promise<boolean> {\n\t\tawait this.waitForInitialization();\n\t\ttry {\n\t\t\tconst session = await this.supabaseClient.getSession();\n\t\t\treturn session != null;\n\t\t} catch {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/auth/services/session-manager.ts#L73-L109","documentation":"During startup, SessionManager.migrateLegacyAuth found an old auth.json (pre-Supabase credential store) but no valid Supabase session to migrate into. The legacy file is kept, the user is warned, and authentication is required again. Errors during migration are swallowed to debug level so startup continues.","triggerScenarios":"Upgrading task-master from the legacy auth.json version to Supabase-backed auth while the stored legacy token is expired/invalid, the Supabase session file is missing/corrupt, or the user never ran 'task-master auth login' after upgrading.","commonSituations":"Version migration on a machine where the old token long expired; copying dotfiles/config between machines without the new session store; clock skew invalidating sessions; partially failed migration (unlink failed so both files linger).","solutions":["Run 'task-master auth login' to obtain a fresh Supabase session; the legacy file will be cleaned up afterwards.","Delete the stale legacy auth.json manually if login succeeded but the warning persists.","Check the debug log ('Error during legacy auth migration') for the underlying failure (permissions, corrupt JSON).","Ensure the system clock is correct if sessions are being rejected immediately after login."],"exampleFix":"// before\n$ cat ~/.taskmaster/auth.json // legacy expired token\n// after\n$ task-master auth login // creates Supabase session, removes auth.json","handlingStrategy":"fallback","validationCode":"import fs from 'fs';\nif (fs.existsSync(legacyAuthFile)) {\n  console.warn('Legacy auth.json present. Run: task-master auth login');\n}","typeGuard":"function hasValidSupabaseSession(session) {\n  return !!session && typeof session.access_token === 'string' &&\n         typeof session.refresh_token === 'string' &&\n         new Date(session.expires_at * 1000) > new Date();\n}","tryCatchPattern":"try {\n  await sessionManager.initialize();\n} catch (err) {\n  console.warn('Auth unavailable after legacy migration check. Run: task-master auth login');\n}","preventionTips":["Run 'task-master auth login' immediately after upgrading to a Supabase-backed version.","Remove stale ~/.taskmaster/auth.json when copying configs between machines.","Keep the system clock accurate so migrated/new sessions aren't rejected.","Check debug logs for migration errors if the warning repeats after login."],"tags":["auth","migration","supabase","legacy","session"],"backgroundTag":"auth-migration-failed","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}