Graphify-Labs/graphify · error · ValueError
Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be se
Error message
Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be set.
What it means
ValueError raised when backend='azure' is configured but the AZURE_OPENAI_ENDPOINT environment variable is empty/whitespace. graphify constructs the Azure client from this env var (stripped) plus the API key; without an endpoint there is nothing to call, so it fails fast before any request.
Source
Thrown at graphify/llm.py:2685
read_timeout=_resolve_api_timeout(),
connect_timeout=10,
retries={"max_attempts": _resolve_max_retries() + 1, "mode": "adaptive"},
),
)
resp = client.converse(
modelId=mdl,
messages=[{"role": "user", "content": [{"text": prompt}]}],
inferenceConfig=_bedrock_inference_config(max_tokens, mdl),
)
bu = resp.get("usage") or {}
if bu:
_rec(bu.get("inputTokens", 0), bu.get("outputTokens", 0))
return _bedrock_response_text(resp, default="")
if backend == "azure":
endpoint = os.environ.get("AZURE_OPENAI_ENDPOINT", "").strip()
if not endpoint:
raise ValueError(
"Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be set."
)
azure_client = _azure_client(key, endpoint)
azure_kwargs: dict = {
"model": mdl,
"messages": [{"role": "user", "content": prompt}],
"max_completion_tokens": max_tokens,
}
azure_temp = _resolve_temperature(cfg.get("temperature", 0), mdl)
if azure_temp is not None:
azure_kwargs["temperature"] = azure_temp
resp = azure_client.chat.completions.create(**azure_kwargs)
if not resp.choices or resp.choices[0].message is None:
raise ValueError("Azure OpenAI returned empty or filtered response")
au = getattr(resp, "usage", None)
if au is not None:
_rec(getattr(au, "prompt_tokens", 0), getattr(au, "completion_tokens", 0))
return resp.choices[0].message.content or ""View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Set the endpoint: export AZURE_OPENAI_ENDPOINT='https://<your-resource>.openai.azure.com' (find it on the Azure OpenAI resource Overview page).
- If using a .env file, confirm it is actually loaded by the process that runs graphify (printenv AZURE_OPENAI_ENDPOINT to verify).
- If you did not mean Azure, switch the backend to openai/claude/etc.
Example fix
# before export AZURE_OPENAI_API_KEY=... # AZURE_OPENAI_ENDPOINT missing $ graphify label --backend azure # ValueError # after export AZURE_OPENAI_ENDPOINT="https://my-resource.openai.azure.com" # your resource URL $ graphify label --backend azure
Defensive patterns
Strategy: validation
Validate before calling
import os
endpoint = os.environ.get("AZURE_OPENAI_ENDPOINT", "").strip()
if not endpoint:
raise SystemExit(
"backend 'azure' requires AZURE_OPENAI_ENDPOINT"
" (https://<resource>.openai.azure.com)"
) Try / catch
try:
result = call_llm(prompt, backend="azure")
except ValueError as exc:
if "AZURE_OPENAI_ENDPOINT" in str(exc):
raise SystemExit("Set AZURE_OPENAI_ENDPOINT to your Azure OpenAI resource URL") from exc
raise Prevention
- Treat Azure as a three-part config: endpoint env var, key env var, deployed model name - check all three together.
- Fail fast at startup on missing env config instead of discovering it mid-run.
- Prefer a single sourced env file over scattered exports.
When it happens
Trigger: Selecting backend 'azure' with AZURE_OPENAI_ENDPOINT unset or containing only whitespace (llm.py:2684-2687). The key comes from _azure_client(key, endpoint); the endpoint must be the Azure OpenAI resource endpoint (https://<resource>.openai.azure.com).
Common situations: Copy-pasting config from a colleague without the env var; .env file not loaded in CI; setting AZURE_OPENAI_API_KEY but forgetting the endpoint var; shell quoting mistakes that leave the var empty.
Related errors
- Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be se
- Azure OpenAI returned empty or filtered response
- No LLM backend configured. Set one of: GEMINI_API_KEY, ANTHR
- No API key for backend '{backend}'. Set {_format_backend_env
- No API key for backend '{backend}'. Set {_format_backend_env
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/0a477ede58ed0f35.
Report an issue: GitHub.