stanford-oval/storm · error · RuntimeError
You must supply azure_ai_search_index_name or set environmen
Error message
You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME
What it means
Raised by AzureAISearchRM.__init__ when the search index name is neither passed as azure_ai_search_index_name nor available via the AZURE_AI_SEARCH_INDEX_NAME environment variable. The index identifies which document collection to query, so the constructor refuses to continue without it.
Source
Thrown at knowledge_storm/rm.py:1168
)
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"]
self.usage = 0
# If not None, is_valid_source shall be a function that takes a URL and returns a boolean.
if is_valid_source:
self.is_valid_source = is_valid_source
else:
self.is_valid_source = lambda x: True
def get_usage_and_reset(self):
usage = self.usage
self.usage = 0View on GitHub (pinned to fb951af774)
Solutions
- export AZURE_AI_SEARCH_INDEX_NAME="<your-index-name>"
- Or pass it explicitly: AzureAISearchRM(azure_ai_search_api_key=..., azure_ai_search_url=..., azure_ai_search_index_name="my-index")
- Verify the index exists in the Azure portal (Search service > Indexes) and matches the name you supply
Example fix
# before rm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url=URL) # after rm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url=URL, azure_ai_search_index_name="my-index")
Defensive patterns
Strategy: validation
Validate before calling
import os
def has_azure_index_name(explicit=None):
return bool(explicit or os.environ.get("AZURE_AI_SEARCH_INDEX_NAME"))
assert has_azure_index_name(), "Missing AZURE_AI_SEARCH_INDEX_NAME" Try / catch
try:
rm = AzureAISearchRM(azure_ai_search_api_key=K, azure_ai_search_url=U)
except RuntimeError as e:
if "AZURE_AI_SEARCH_INDEX_NAME" in str(e):
raise SystemExit("Set AZURE_AI_SEARCH_INDEX_NAME to an existing index")
raise Prevention
- Add all three Azure vars to your deployment env template so none is forgotten
- Confirm the index exists in the portal before wiring the retriever
- Use a config object/dataclass that requires index_name at construction
When it happens
Trigger: Constructing AzureAISearchRM with no azure_ai_search_index_name argument and no AZURE_AI_SEARCH_INDEX_NAME env var; this is the last of the three lazy config checks (key, url, index).
Common situations: Key and URL configured but index name forgotten; index name typo'd earlier so the developer removed it; multi-index deployments where the index name is only known per-environment and wasn't propagated to the container/CI env.
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_url or set environment varia
- 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/2553ac8e1c0bd3da.
Report an issue: GitHub.