{"record":{"id":"2553ac8e1c0bd3da","repo":"stanford-oval/storm","slug":"you-must-supply-azure-ai-search-index-name-or-set","errorCode":null,"errorMessage":"You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME","messagePattern":"You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"knowledge_storm/rm.py","lineNumber":1168,"sourceCode":"            )\n        elif azure_ai_search_api_key:\n            self.azure_ai_search_api_key = azure_ai_search_api_key\n        else:\n            self.azure_ai_search_api_key = os.environ[\"AZURE_AI_SEARCH_API_KEY\"]\n\n        if not azure_ai_search_url and not os.environ.get(\"AZURE_AI_SEARCH_URL\"):\n            raise RuntimeError(\n                \"You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL\"\n            )\n        elif azure_ai_search_url:\n            self.azure_ai_search_url = azure_ai_search_url\n        else:\n            self.azure_ai_search_url = os.environ[\"AZURE_AI_SEARCH_URL\"]\n\n        if not azure_ai_search_index_name and not os.environ.get(\n            \"AZURE_AI_SEARCH_INDEX_NAME\"\n        ):\n            raise RuntimeError(\n                \"You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME\"\n            )\n        elif azure_ai_search_index_name:\n            self.azure_ai_search_index_name = azure_ai_search_index_name\n        else:\n            self.azure_ai_search_index_name = os.environ[\"AZURE_AI_SEARCH_INDEX_NAME\"]\n\n        self.usage = 0\n\n        # If not None, is_valid_source shall be a function that takes a URL and returns a boolean.\n        if is_valid_source:\n            self.is_valid_source = is_valid_source\n        else:\n            self.is_valid_source = lambda x: True\n\n    def get_usage_and_reset(self):\n        usage = self.usage\n        self.usage = 0","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/rm.py#L1150-L1186","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nrm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url=URL)\n\n# after\nrm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url=URL, azure_ai_search_index_name=\"my-index\")","handlingStrategy":"validation","validationCode":"import os\n\ndef has_azure_index_name(explicit=None):\n    return bool(explicit or os.environ.get(\"AZURE_AI_SEARCH_INDEX_NAME\"))\n\nassert has_azure_index_name(), \"Missing AZURE_AI_SEARCH_INDEX_NAME\"","typeGuard":null,"tryCatchPattern":"try:\n    rm = AzureAISearchRM(azure_ai_search_api_key=K, azure_ai_search_url=U)\nexcept RuntimeError as e:\n    if \"AZURE_AI_SEARCH_INDEX_NAME\" in str(e):\n        raise SystemExit(\"Set AZURE_AI_SEARCH_INDEX_NAME to an existing index\")\n    raise","preventionTips":["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"],"tags":["azure","env-var","configuration","index-name"],"backgroundTag":"missing-env-var","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}