{"record":{"id":"11125f6edb2c9fff","repo":"microsoft/autogen","slug":"unauthorized","errorCode":null,"errorMessage":"Unauthorized","messagePattern":"Unauthorized","errorType":"exception","errorClass":"Error","httpStatus":401,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/auth/api.ts","lineNumber":80,"sourceCode":"      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      }\n\n      const data = await response.json();\n      return data;\n    } catch (error) {\n      console.error(\"Error getting current user:\", error);\n      throw error;\n    }\n  }\n\n  async checkAuthType(): Promise<{ type: string }> {\n    try {\n      const response = await fetch(`${this.getBaseUrl()}/auth/type`, {\n        headers: this.getHeaders(),\n      });\n\n      const data = await response.json();\n      return data;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/auth/api.ts#L62-L98","documentation":"Raised when `embedding_provider=\"azure_openai\"` is configured but the `openai` and/or `azure-identity` packages are not installed in the environment. The import is done lazily inside _get_embedding so the base tool works without them, but the Azure OpenAI embedding path has a hard dependency on AsyncAzureOpenAI and DefaultAzureCredential.","triggerScenarios":"Choosing embedding_provider='azure_openai' with vector_fields, then executing a search — the try-import of `openai.AsyncAzureOpenAI` / `azure.identity.DefaultAzureCredential` fails with ImportError which is re-raised with install instructions.","commonSituations":"Installing autogen-ext without the openai/azure extras; running in a slim container or lambda where optional deps were pruned; using a dependency resolver that dropped openai after a lock-file regeneration.","solutions":["Install the SDKs: `uv add openai azure-identity` (or `pip install openai azure-identity`) in the same environment running the tool.","Verify with `python -c \"from openai import AsyncAzureOpenAI; from azure.identity import DefaultAzureCredential\"` before deploying.","Alternatively switch to a provider whose deps you already ship, or drop client-side embeddings."],"exampleFix":"# before: ImportError at query time\n# config.embedding_provider = \"azure_openai\"\n\n# after\n# shell:\n#   uv add openai azure-identity\n# (no code change required)","handlingStrategy":"validation","validationCode":"def azure_openai_deps_available() -> bool:\n    try:\n        from openai import AsyncAzureOpenAI  # noqa: F401\n        from azure.identity import DefaultAzureCredential  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    results = await tool.run(query)\nexcept ImportError as e:\n    if \"azure-identity\" in str(e) or \"openai\" in str(e):\n        raise SystemExit(\"Install openai + azure-identity before using azure_openai embeddings\") from e\n    raise","preventionTips":["Declare openai and azure-identity as explicit dependencies when your config uses azure_openai embeddings.","Add an import smoke test to your CI/deploy pipeline."],"tags":["python","dependencies","azure-openai","embeddings"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}