stanford-oval/storm · error · RuntimeError
You must supply azure_ai_search_url or set environment varia
Error message
You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL
What it means
Raised by AzureAISearchRM.__init__ when the Azure AI Search service endpoint URL is neither passed as azure_ai_search_url nor found in the AZURE_AI_SEARCH_URL environment variable. The SDK needs the full service endpoint (e.g., https://<service>.search.windows.net) to build a SearchClient, so construction aborts.
Source
Thrown at knowledge_storm/rm.py:1157
from azure.search.documents import SearchClient
except ImportError as err:
raise ImportError(
"AzureAISearch requires `pip install azure-search-documents`."
) from err
if not azure_ai_search_api_key and not os.environ.get(
"AZURE_AI_SEARCH_API_KEY"
):
raise RuntimeError(
"You must supply azure_ai_search_api_key or set environment variable AZURE_AI_SEARCH_API_KEY"
)
elif azure_ai_search_api_key:
self.azure_ai_search_api_key = azure_ai_search_api_key
else:
self.azure_ai_search_api_key = os.environ["AZURE_AI_SEARCH_API_KEY"]
if not azure_ai_search_url and not os.environ.get("AZURE_AI_SEARCH_URL"):
raise RuntimeError(
"You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL"
)
elif azure_ai_search_url:
self.azure_ai_search_url = azure_ai_search_url
else:
self.azure_ai_search_url = os.environ["AZURE_AI_SEARCH_URL"]
if not azure_ai_search_index_name and not os.environ.get(
"AZURE_AI_SEARCH_INDEX_NAME"
):
raise RuntimeError(
"You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME"
)
elif azure_ai_search_index_name:
self.azure_ai_search_index_name = azure_ai_search_index_name
else:
self.azure_ai_search_index_name = os.environ["AZURE_AI_SEARCH_INDEX_NAME"]
View on GitHub (pinned to fb951af774)
Solutions
- export AZURE_AI_SEARCH_URL="https://<your-service-name>.search.windows.net"
- Or pass it explicitly: AzureAISearchRM(azure_ai_search_api_key=..., azure_ai_search_url="https://<svc>.search.windows.net", azure_ai_search_index_name=...)
- Copy the exact 'Url' value from the Azure portal's Search service Overview page
Example fix
# before rm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_index_name=IDX) # after rm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url="https://mysvc.search.windows.net", azure_ai_search_index_name=IDX)
Defensive patterns
Strategy: validation
Validate before calling
import os
def has_azure_search_url(explicit=None):
return bool(explicit or os.environ.get("AZURE_AI_SEARCH_URL"))
assert has_azure_search_url(), "Missing AZURE_AI_SEARCH_URL" Try / catch
try:
rm = AzureAISearchRM(azure_ai_search_api_key=K, azure_ai_search_index_name=I)
except RuntimeError as e:
if "AZURE_AI_SEARCH_URL" in str(e):
raise SystemExit("Set AZURE_AI_SEARCH_URL to https://<service>.search.windows.net")
raise Prevention
- Store the full endpoint (scheme + host) in config, not just the resource name
- Validate endpoint format with a regex like ^https://[a-z0-9-]+\.search\.windows\.net$
- Keep per-environment configs (dev/stage/prod) each with their own URL
When it happens
Trigger: Constructing AzureAISearchRM with no azure_ai_search_url argument and no AZURE_AI_SEARCH_URL env var; reached only after the API key check has passed.
Common situations: Developer supplied the key but not the endpoint; copied the index name or resource name instead of the full endpoint URL; env var set in local shell but not in the deployed/containerized process.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- You must supply azure_ai_search_api_key or set environment v
- You must supply azure_ai_search_index_name or set environmen
- You must supply google_cse_id or set the GOOGLE_CSE_ID envir
- Please provide an embedding model.
- Please provide a url for the Qdrant server.
AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28).
Data as JSON: /api/errors/9f4ed93aa1c1c2d6.
Report an issue: GitHub.