microsoft/autogen · error · Error

Invalid server URL configuration

Error message

Invalid server URL configuration

What it means

Raised when SearchClient construction raises ResourceNotFoundError, meaning the configured index_name does not exist on the search service. The tool surfaces it as a ValueError naming the missing index so agents/callers get a human-readable message instead of an SDK exception.

Source

Thrown at python/packages/autogen-studio/frontend/src/components/views/labs/labs/api.ts:40

  | { error: string };

export class ToolMakerAPI extends BaseAPI {
  ws: WebSocket | null = null;

  // Helper for WebSocket URL construction (similar to MCP implementation)
  private getWebSocketBaseUrl(url: string): string {
    try {
      let baseUrl = url.replace(/(^\w+:|^)\/\//, "");
      if (baseUrl.startsWith("localhost")) {
        baseUrl = baseUrl.replace("/api", "");
      } else if (baseUrl === "/api") {
        baseUrl = window.location.host;
      } else {
        baseUrl = baseUrl.replace("/api", "").replace(/\/$/, "");
      }
      return baseUrl;
    } catch (error) {
      throw new Error("Invalid server URL configuration");
    }
  }

  connect(
    onMessage: (msg: ToolMakerStreamMessage) => void,
    onError?: (err: any) => void,
    onClose?: () => void
  ) {
    // Use the same server URL logic as other APIs
    const serverUrl = this.getBaseUrl(); // e.g., "/api" or "http://localhost:8081/api"
    const baseUrl = this.getWebSocketBaseUrl(serverUrl);
    const protocol = window.location.protocol === "https:" ? "wss:" : "ws:";
    const wsUrl = `${protocol}//${baseUrl}/api/maker/tool`;
    this.ws = new window.WebSocket(wsUrl);
    this.ws.onmessage = (event) => {
      try {
        const data = JSON.parse(event.data);
        onMessage(data);

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. List indexes to confirm the exact name: `az search index list --service-name <svc> --resource-group <rg> --query "[].name"`.
  2. Fix index_name in the config, including exact casing.
  3. Create the index (portal, REST PUT /indexes, or SDK SearchIndexClient.create_index) before starting the tool.
  4. Verify endpoint points to the service that actually hosts the index.

Example fix

# before
config = AzureAISearchConfig(endpoint=E, index_name="hoteldocs", credential={"api_key": K})

# after
config = AzureAISearchConfig(endpoint=E, index_name="hotel-docs", credential={"api_key": K})  # exact name from `az search index list`
Defensive patterns

Strategy: try-catch

Validate before calling

from azure.search.documents.indexes.aio import SearchIndexClient
from azure.core.credentials import AzureKeyCredential

async def index_exists(endpoint: str, index_name: str, key: str) -> bool:
    client = SearchIndexClient(endpoint, AzureKeyCredential(key))
    try:
        names = [i async for i in client.list_index_names()]
        return index_name in names
    finally:
        await client.close()

Try / catch

try:
    results = await tool.run(query)
except ValueError as e:
    if "not found in Azure AI Search" in str(e):
        # reconfigure to the correct index or surface a clear agent message
        raise
    raise

Prevention

When it happens

Trigger: First call to run() (which lazily initializes the client via _get_client) with index_name that doesn't match any index on the service — typo, index in a different resource, or index not yet created.

Common situations: Typo in index_name; pointing endpoint at a different Azure AI Search service (e.g. staging config in prod); index creation job (importers, push API seeding) not finished before the app started; case mismatch — index names are case-sensitive.

Related errors


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