{"record":{"id":"94dff2679452165b","repo":"microsoft/autogen","slug":"authentication-failed","errorCode":null,"errorMessage":"Authentication failed","messagePattern":"Authentication failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/auth/api.ts","lineNumber":63,"sourceCode":"  }\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\",\n          headers: this.getHeaders(),\n          body: JSON.stringify({ code, state }),\n        }\n      );\n\n      const data = await response.json();\n      if (!data.token || !data.user) {\n        throw new Error(\"Authentication failed\");\n      }\n\n      return data;\n    } catch (error) {\n      console.error(\"Error handling auth callback:\", error);\n      throw error;\n    }\n  }\n\n  async getCurrentUser(token: string): Promise<User> {\n    try {\n      const response = await fetch(`${this.getBaseUrl()}/auth/me`, {\n        headers: this.getHeaders(token),\n      });\n\n      if (response.status === 401) {\n        throw new Error(\"Unauthorized\");\n      }","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/auth/api.ts#L45-L81","documentation":"Raised when vector search is requested with vector_fields configured, but the AzureAISearchConfig lacks `embedding_provider` and/or `embedding_model`. Client-side embedding generation (turning query text into a vector before sending to Azure AI Search) requires both fields; without them the library cannot produce vectors.","triggerScenarios":"Setting `vector_fields` on the config while omitting `embedding_provider` or `embedding_model` (i.e. not using server-side vectorization via VectorizableTextQuery), then running a search whose code path takes the client-side embedding branch because both fields must be truthy — any miss triggers this ValueError inside _get_embedding.","commonSituations":"Configuring a vector index but assuming the service does the vectorization while also omitting the vectorizer setup; migrating from an older config where embedding fields were optional; copy-pasting a config example that predates client-side embedding support.","solutions":["Set both `embedding_provider` (\"azure_openai\" or \"openai\") and `embedding_model` (e.g. \"text-embedding-3-small\") on AzureAISearchConfig when using vector_fields.","If you want server-side vectorization instead, clear embedding_model/embedding_provider so the tool uses VectorizableTextQuery against an index-configured vectorizer.","Remove vector_fields if you only need full-text or semantic search."],"exampleFix":"# before\nconfig = AzureAISearchConfig(\n    endpoint=ENDPOINT, index_name=IDX, credential={\"api_key\": KEY},\n    vector_fields=[\"contentVector\"],\n)  # ValueError at query time\n\n# after\nconfig = AzureAISearchConfig(\n    endpoint=ENDPOINT, index_name=IDX, credential={\"api_key\": KEY},\n    vector_fields=[\"contentVector\"],\n    embedding_provider=\"azure_openai\",\n    embedding_model=\"text-embedding-3-large\",\n    openai_endpoint=\"https://myres.openai.azure.com\",\n    openai_api_key=OPENAI_KEY,\n)","handlingStrategy":"validation","validationCode":"def validate_vector_config(cfg) -> None:\n    if cfg.vector_fields:\n        if not (cfg.embedding_provider and cfg.embedding_model):\n            raise ValueError(\"vector_fields requires embedding_provider + embedding_model (or clear them for server-side vectorization)\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat embedding_provider/embedding_model as a pair: set or clear both together.","Add a config sanity check at app startup, not at first query."],"tags":["python","azure-ai-search","embeddings","configuration"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}