{"record":{"id":"ffd65ed625cba6a0","repo":"microsoft/autogen","slug":"failed-to-get-login-url","errorCode":null,"errorMessage":"Failed to get login URL","messagePattern":"Failed to get login URL","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/auth/api.ts","lineNumber":37,"sourceCode":"      \"Content-Type\": \"application/json\",\n    };\n\n    if (token) {\n      headers[\"Authorization\"] = `Bearer ${token}`;\n    }\n\n    return headers;\n  }\n\n  async getLoginUrl(): Promise<string> {\n    try {\n      const response = await fetch(`${this.getBaseUrl()}/auth/login-url`, {\n        headers: this.getHeaders(),\n      });\n\n      const data = await response.json();\n      if (!data.login_url) {\n        throw new Error(\"Failed to get login URL\");\n      }\n\n      return data.login_url;\n    } catch (error) {\n      console.error(\"Error getting login URL:\", error);\n      throw error;\n    }\n  }\n\n  async handleCallback(\n    code: string,\n    state?: string\n  ): Promise<{ token: string; user: User }> {\n    try {\n      const response = await fetch(\n        `${this.getBaseUrl()}/auth/callback-handler`,\n        {\n          method: \"POST\",","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/auth/api.ts#L19-L55","documentation":"Thrown by EmbeddingProviderMixin._get_embedding when the host class does not expose a `search_config` attribute. The mixin relies on the host (e.g. BaseAzureAISearchTool subclasses) to define `search_config: AzureAISearchConfig`; the hasattr check is a runtime guard because Python mixins cannot force attribute presence at import time. It almost always indicates the mixin was reused on a class that never sets the config.","triggerScenarios":"Calling `await self._get_embedding(query)` on a class that composes EmbeddingProviderMixin (or EmbeddingProvider in this module) but does not declare/assign `self.search_config` before the call — typically a custom tool class that inherits the mixin directly, or a subclass that overrides __init__ and never calls super().__init__ so the config is never set.","commonSituations":"Developers copy the mixin into their own tool base class and forget the `search_config` class annotation/assignment; subclassing BaseAzureAISearchTool but overriding __init__ without chaining to super(); constructing the tool via a deserialization path that skips config assignment.","solutions":["Inherit from BaseAzureAISearchTool (which sets self.search_config in __init__) instead of composing the mixin directly.","If using the mixin standalone, declare `search_config: AzureAISearchConfig` and assign it in your __init__ before any search/embedding call.","If you overrode __init__ in a subclass, make sure you call super().__init__(...) so the config attribute is populated."],"exampleFix":"# before\nclass MyTool(EmbeddingProviderMixin):\n    async def search(self, q: str):\n        return await self._get_embedding(q)  # ValueError: no search_config\n\n# after\nfrom autogen_ext.tools.azure import AzureAISearchTool  # or your base\nclass MyTool(EmbeddingProviderMixin):\n    def __init__(self) -> None:\n        self.search_config = AzureAISearchConfig(\n            endpoint=\"https://mysvc.search.windows.net\",\n            index_name=\"my-index\",\n            credential={\"api_key\": \"...\"},\n            embedding_provider=\"openai\",\n            embedding_model=\"text-embedding-3-small\",\n        )","handlingStrategy":"validation","validationCode":"from autogen_ext.tools.azure._ai_search import EmbeddingProviderMixin\n\ndef embedding_ready(tool: EmbeddingProviderMixin) -> bool:\n    return hasattr(tool, \"search_config\") and tool.search_config is not None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer inheriting BaseAzureAISearchTool over composing the mixin yourself.","If you use the mixin, declare and assign search_config in __init__ before any await.","Always chain super().__init__ when overriding constructors in subclasses."],"tags":["python","azure-ai-search","configuration","mixin"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}