microsoft/semantic-kernel · error · MemoryConnectorInitializationError
WeaviateMemoryStore requires a URL or API key, or to use emb
Error message
WeaviateMemoryStore requires a URL or API key, or to use embed.
What it means
Raised by the (deprecated) WeaviateMemoryStore constructor (MemoryConnectorInitializationError) when none of the client-creation branches match: use_embed is false, not (api_key AND url), and not url. In other words you provided neither an embedded client, nor a usable URL. This old store only understands url/api_key/use_embed — it does NOT support local_host/local_port modes that the newer WeaviateSettings/WeaviateStore support.
Source
Thrown at python/semantic_kernel/connectors/memory_stores/weaviate/weaviate_memory_store.py:152
"""
self.settings = WeaviateSettings(
url=url,
api_key=api_key,
use_embed=use_embed,
env_file_path=env_file_path,
env_file_encoding=env_file_encoding,
)
if self.settings.use_embed:
self.client = weaviate.Client(embedded_options=weaviate.EmbeddedOptions())
elif self.settings.api_key and self.settings.url:
self.client = weaviate.Client(
url=str(self.settings.url),
auth_client_secret=weaviate.auth.AuthApiKey(api_key=self.settings.api_key.get_secret_value()),
)
elif self.settings.url:
self.client = weaviate.Client(url=str(self.settings.url))
else:
raise MemoryConnectorInitializationError("WeaviateMemoryStore requires a URL or API key, or to use embed.")
async def create_collection(self, collection_name: str) -> None:
"""Creates a new collection in Weaviate."""
schema = SCHEMA.copy()
schema["class"] = collection_name
await asyncio.get_running_loop().run_in_executor(None, self.client.schema.create_class, schema)
async def get_collections(self) -> list[str]:
"""Returns a list of all collections in Weaviate."""
schemas = await asyncio.get_running_loop().run_in_executor(None, self.client.schema.get)
return [schema["class"] for schema in schemas["classes"]]
async def delete_collection(self, collection_name: str) -> bool:
"""Deletes a collection in Weaviate."""
await asyncio.get_running_loop().run_in_executor(None, self.client.schema.delete_class, collection_name)
async def does_collection_exist(self, collection_name: str) -> bool:
"""Checks if a collection exists in Weaviate."""View on GitHub (pinned to c028a0c7dc)
Solutions
- Set WEAVIATE_URL (and WEAVIATE_API_KEY for WCD) env vars, or pass url= and api_key= explicitly.
- For local dev/embedded, set WEAVIATE_USE_EMBED=true (or pass use_embed=True).
- Migrate to the non-deprecated WeaviateStore + collection, which also supports WEAVIATE_LOCAL_HOST/PORT for Docker.
Example fix
// before store = WeaviateMemoryStore() # raises // after store = WeaviateMemoryStore(url='https://xxx.weaviate.network', api_key='secret') // or store = WeaviateMemoryStore(use_embed=True)
Defensive patterns
Strategy: validation
Validate before calling
import os
url = os.environ.get('WEAVIATE_URL')
api_key = os.environ.get('WEAVIATE_API_KEY')
use_embed = os.environ.get('WEAVIATE_USE_EMBED', '').lower() == 'true'
assert use_embed or url, 'set WEAVIATE_URL (+WEAVIATE_API_KEY) or WEAVIATE_USE_EMBED=true'
store = WeaviateMemoryStore(url=url, api_key=api_key, use_embed=use_embed) Try / catch
from semantic_kernel.exceptions.memory_connector_exceptions import MemoryConnectorInitializationError
try:
store = WeaviateMemoryStore(url=url, api_key=api_key)
except MemoryConnectorInitializationError:
store = WeaviateMemoryStore(use_embed=True) # local fallback Prevention
- Set WEAVIATE_URL and WEAVIATE_API_KEY (for WCD) or WEAVIATE_USE_EMBED=true in your environment.
- Load .env before constructing (pass env_file_path or use python-dotenv).
- For local Docker, prefer the non-deprecated WeaviateStore which supports WEAVIATE_LOCAL_HOST/PORT.
When it happens
Trigger: Constructing `WeaviateMemoryStore()` with no arguments and no WEAVIATE_URL / WEAVIATE_USE_EMBED env vars; or supplying only an api_key without a url; or wanting a local Docker instance via local_host (unsupported by this deprecated class).
Common situations: Missing/misspelled WEAVIATE_URL or WEAVIATE_API_KEY env vars; .env file not loaded; pointing at Weaviate Cloud without the API key; trying local Docker mode with the deprecated store (use WeaviateStore instead).
Related errors
- Path of persist directory is not set
- Persist directory is not set
- Failed to create Azure OpenAI settings: {exc}
- Please provide an Azure OpenAI endpoint
- Please provide an Azure OpenAI deployment name
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/95bca0983b9f04bf.
Report an issue: GitHub.