{"record":{"id":"09dab79798a7fadb","repo":"eyaltoledano/claude-task-master","slug":"getinstance-called-with-config-after-initializatio","errorCode":null,"errorMessage":"getInstance called with config after initialization; config is ignored.","messagePattern":"getInstance called with config after initialization; config is ignored\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/tm-core/src/modules/auth/managers/auth-manager.ts","lineNumber":70,"sourceCode":"\t\t);\n\n\t\t// Pass the supabase client to OAuthService so they share the same instance\n\t\tthis.oauthService = new OAuthService(\n\t\t\tthis.contextStore,\n\t\t\tthis.supabaseClient,\n\t\t\tconfig\n\t\t);\n\t}\n\n\t/**\n\t * Get singleton instance\n\t */\n\tstatic getInstance(config?: Partial<AuthConfig>): AuthManager {\n\t\tif (!AuthManager.instance) {\n\t\t\tAuthManager.instance = new AuthManager(config);\n\t\t} else if (config) {\n\t\t\t// Warn if config is provided after initialization\n\t\t\tAuthManager.staticLogger.warn(\n\t\t\t\t'getInstance called with config after initialization; config is ignored.'\n\t\t\t);\n\t\t}\n\t\treturn AuthManager.instance;\n\t}\n\n\t/**\n\t * Reset the singleton instance (useful for testing)\n\t * Also resets SupabaseAuthClient to ensure clean state for test isolation\n\t */\n\tstatic resetInstance(): void {\n\t\tAuthManager.instance = null;\n\t\tContextStore.resetInstance();\n\t\tSupabaseAuthClient.resetInstance();\n\t}\n\n\t/**\n\t * Get access token from current Supabase session","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/packages/tm-core/src/modules/auth/managers/auth-manager.ts#L52-L88","documentation":"AuthManager is a singleton: getInstance(config) only applies config on the very first call that constructs the instance. If a config is passed on a later call, it is silently ignored and this warning is logged so misconfiguration doesn't go unnoticed.","triggerScenarios":"Calling AuthManager.getInstance({ customApiUrl }) after some other code (e.g. the CLI constructor or a domain facade) already created the singleton, typically during 'called by: constructor' initialization paths.","commonSituations":"Multiple modules each calling getInstance with their own config; tests reusing a singleton across test cases; env/config loaded lazily after the first getInstance call.","solutions":["Call getInstance with the full config at the application's earliest entry point, before anything else touches AuthManager.","Remove redundant config arguments from later getInstance calls and use the existing instance.","In tests, reset the singleton (e.g. AuthManager.instance = undefined via any provided reset) before configuring.","Refactor to pass config through an init/configure method instead of relying on first-call semantics."],"exampleFix":"// before\nconst a = AuthManager.getInstance(); // constructed with defaults\nconst b = AuthManager.getInstance({ apiUrl }); // ignored + warning\n// after\nconst a = AuthManager.getInstance({ apiUrl }); // first call wins\nconst b = AuthManager.getInstance();","handlingStrategy":"validation","validationCode":"const first = AuthManager.getInstance(config); // apply config exactly once, at startup\n// elsewhere:\nconst manager = AuthManager.getInstance(); // no config arg","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Centralize AuthManager construction in a single bootstrap module.","Never pass config to getInstance after application startup.","Reset singletons between tests via the designated reset hook, then re-apply config.","Load env/config before any code path touches AuthManager."],"tags":["auth","singleton","configuration","typescript"],"backgroundTag":"singleton-config-ignored","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}