microsoft/autogen · error · Error

Authentication failed

Error message

Authentication failed

What it means

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.

Source

Thrown at python/packages/autogen-studio/frontend/src/auth/api.ts:63

  }

  async handleCallback(
    code: string,
    state?: string
  ): Promise<{ token: string; user: User }> {
    try {
      const response = await fetch(
        `${this.getBaseUrl()}/auth/callback-handler`,
        {
          method: "POST",
          headers: this.getHeaders(),
          body: JSON.stringify({ code, state }),
        }
      );

      const data = await response.json();
      if (!data.token || !data.user) {
        throw new Error("Authentication failed");
      }

      return data;
    } catch (error) {
      console.error("Error handling auth callback:", error);
      throw error;
    }
  }

  async getCurrentUser(token: string): Promise<User> {
    try {
      const response = await fetch(`${this.getBaseUrl()}/auth/me`, {
        headers: this.getHeaders(token),
      });

      if (response.status === 401) {
        throw new Error("Unauthorized");
      }

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Set both `embedding_provider` ("azure_openai" or "openai") and `embedding_model` (e.g. "text-embedding-3-small") on AzureAISearchConfig when using vector_fields.
  2. If you want server-side vectorization instead, clear embedding_model/embedding_provider so the tool uses VectorizableTextQuery against an index-configured vectorizer.
  3. Remove vector_fields if you only need full-text or semantic search.

Example fix

# before
config = AzureAISearchConfig(
    endpoint=ENDPOINT, index_name=IDX, credential={"api_key": KEY},
    vector_fields=["contentVector"],
)  # ValueError at query time

# after
config = AzureAISearchConfig(
    endpoint=ENDPOINT, index_name=IDX, credential={"api_key": KEY},
    vector_fields=["contentVector"],
    embedding_provider="azure_openai",
    embedding_model="text-embedding-3-large",
    openai_endpoint="https://myres.openai.azure.com",
    openai_api_key=OPENAI_KEY,
)
Defensive patterns

Strategy: validation

Validate before calling

def validate_vector_config(cfg) -> None:
    if cfg.vector_fields:
        if not (cfg.embedding_provider and cfg.embedding_model):
            raise ValueError("vector_fields requires embedding_provider + embedding_model (or clear them for server-side vectorization)")

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/94dff2679452165b. Report an issue: GitHub.