bytedance/deer-flow · error · ValueError
mem0 API key missing: environment variable {self.api_key_env
Error message
mem0 API key missing: environment variable {self.api_key_env} is unset or empty What it means
Error "mem0 API key missing: environment variable {self.api_key_env} is unset or empty" thrown in bytedance/deer-flow.
Source
Thrown at backend/packages/harness/deerflow/agents/memory/backends/mem0/config.py:123
raise ValueError("mem0 score_threshold must be in [0, 1]")
if config.max_injection_chars <= 0:
raise ValueError("mem0 max_injection_chars must be positive")
if config.timeout_seconds <= 0:
raise ValueError("mem0 timeout_seconds must be positive")
if not config.api_key_env.strip():
raise ValueError("mem0 api_key_env must be a non-empty env var name")
parsed_base_url = urlsplit(config.base_url)
if parsed_base_url.scheme not in {"http", "https"} or not parsed_base_url.netloc:
raise ValueError("mem0 base_url must be an absolute http:// or https:// URL")
if parsed_base_url.scheme == "http" and not config.allow_insecure_http:
raise ValueError("mem0 base_url must use https:// because it carries the API key; set allow_insecure_http: true only for trusted local development")
return config
def resolve_api_key(self) -> str:
"""Read the API key from the configured environment variable."""
key = os.environ.get(self.api_key_env, "").strip()
if not key:
raise ValueError(f"mem0 API key missing: environment variable {self.api_key_env} is unset or empty")
return key
View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Export the named environment variable with a valid mem0 API key before starting the Gateway.
- Change api_key_env in backend_config to point at the variable that actually holds the key.
When it happens
Trigger: Thrown at backend/packages/harness/deerflow/agents/memory/backends/mem0/config.py:123 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/b3b9ef56f793b503.
Report an issue: GitHub.