{"record":{"id":"3f19107f7cc9df72","repo":"microsoft/autogen","slug":"invalid-server-url-configuration","errorCode":null,"errorMessage":"Invalid server URL configuration","messagePattern":"Invalid server URL configuration","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/labs/labs/api.ts","lineNumber":40,"sourceCode":"  | { error: string };\n\nexport class ToolMakerAPI extends BaseAPI {\n  ws: WebSocket | null = null;\n\n  // Helper for WebSocket URL construction (similar to MCP implementation)\n  private getWebSocketBaseUrl(url: string): string {\n    try {\n      let baseUrl = url.replace(/(^\\w+:|^)\\/\\//, \"\");\n      if (baseUrl.startsWith(\"localhost\")) {\n        baseUrl = baseUrl.replace(\"/api\", \"\");\n      } else if (baseUrl === \"/api\") {\n        baseUrl = window.location.host;\n      } else {\n        baseUrl = baseUrl.replace(\"/api\", \"\").replace(/\\/$/, \"\");\n      }\n      return baseUrl;\n    } catch (error) {\n      throw new Error(\"Invalid server URL configuration\");\n    }\n  }\n\n  connect(\n    onMessage: (msg: ToolMakerStreamMessage) => void,\n    onError?: (err: any) => void,\n    onClose?: () => void\n  ) {\n    // Use the same server URL logic as other APIs\n    const serverUrl = this.getBaseUrl(); // e.g., \"/api\" or \"http://localhost:8081/api\"\n    const baseUrl = this.getWebSocketBaseUrl(serverUrl);\n    const protocol = window.location.protocol === \"https:\" ? \"wss:\" : \"ws:\";\n    const wsUrl = `${protocol}//${baseUrl}/api/maker/tool`;\n    this.ws = new window.WebSocket(wsUrl);\n    this.ws.onmessage = (event) => {\n      try {\n        const data = JSON.parse(event.data);\n        onMessage(data);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/labs/labs/api.ts#L22-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List indexes to confirm the exact name: `az search index list --service-name <svc> --resource-group <rg> --query \"[].name\"`.","Fix index_name in the config, including exact casing.","Create the index (portal, REST PUT /indexes, or SDK SearchIndexClient.create_index) before starting the tool.","Verify endpoint points to the service that actually hosts the index."],"exampleFix":"# before\nconfig = AzureAISearchConfig(endpoint=E, index_name=\"hoteldocs\", credential={\"api_key\": K})\n\n# after\nconfig = AzureAISearchConfig(endpoint=E, index_name=\"hotel-docs\", credential={\"api_key\": K})  # exact name from `az search index list`","handlingStrategy":"try-catch","validationCode":"from azure.search.documents.indexes.aio import SearchIndexClient\nfrom azure.core.credentials import AzureKeyCredential\n\nasync def index_exists(endpoint: str, index_name: str, key: str) -> bool:\n    client = SearchIndexClient(endpoint, AzureKeyCredential(key))\n    try:\n        names = [i async for i in client.list_index_names()]\n        return index_name in names\n    finally:\n        await client.close()","typeGuard":null,"tryCatchPattern":"try:\n    results = await tool.run(query)\nexcept ValueError as e:\n    if \"not found in Azure AI Search\" in str(e):\n        # reconfigure to the correct index or surface a clear agent message\n        raise\n    raise","preventionTips":["Run an index-exists health check at startup against the exact index_name (case-sensitive).","Make index creation part of the deployment pipeline before the app starts."],"tags":["python","azure-ai-search","index-not-found","configuration"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}