{"record":{"id":"da6edc4a15ac1ed7","repo":"Graphify-Labs/graphify","slug":"azure-openai-backend-requires-azure-openai-endpoin","errorCode":null,"errorMessage":"Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be set (e.g. https://my-resource.openai.azure.com/).","messagePattern":"Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be set \\(e\\.g\\. https://my-resource\\.openai\\.azure\\.com/\\)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"graphify/llm.py","lineNumber":1814,"sourceCode":"    vision = _backend_supports_vision(backend)\n    # Only base64 (inline) vision backends need the bytes loaded + size-capped;\n    # path-based backends (claude-cli) and non-vision backends do not.\n    read_bytes = vision and backend not in _PATH_IMAGE_BACKENDS\n    image_refs = _build_image_refs(image_files, root, read_bytes=read_bytes) if image_files else []\n    if image_refs and not vision:\n        image_refs = _strip_pixels(image_refs)\n    max_out = _resolve_max_tokens(cfg.get(\"max_tokens\", 8192))\n\n    if backend == \"claude\":\n        result = _call_claude(key, mdl, user_msg, max_tokens=max_out, deep_mode=deep_mode, images=image_refs)\n    elif backend == \"claude-cli\":\n        result = _call_claude_cli(user_msg, max_tokens=max_out, deep_mode=deep_mode, images=image_refs)\n    elif backend == \"bedrock\":\n        result = _call_bedrock(mdl, user_msg, max_tokens=max_out, deep_mode=deep_mode, images=image_refs)\n    elif backend == \"azure\":\n        endpoint = os.environ.get(\"AZURE_OPENAI_ENDPOINT\", \"\").strip()\n        if not endpoint:\n            raise ValueError(\n                \"Azure OpenAI backend requires AZURE_OPENAI_ENDPOINT to be set \"\n                \"(e.g. https://my-resource.openai.azure.com/).\"\n            )\n        result = _call_azure(\n            key,\n            endpoint,\n            mdl,\n            user_msg,\n            temperature=_resolve_temperature(cfg.get(\"temperature\", 0), mdl),\n            max_tokens=max_out,\n            deep_mode=deep_mode,\n        )\n    else:\n        result = _call_openai_compat(\n            cfg[\"base_url\"],\n            key,\n            mdl,\n            user_msg,","sourceCodeStart":1796,"sourceCodeEnd":1832,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/llm.py#L1796-L1832","documentation":"Raised on the `azure` dispatch path when `os.environ.get(\"AZURE_OPENAI_ENDPOINT\")` is empty. The Azure backend needs BOTH AZURE_OPENAI_API_KEY (checked earlier via key resolution) and AZURE_OPENAI_ENDPOINT (the resource URL) to build the AzureOpenAI client; the key alone is not enough.","triggerScenarios":"`backend=\"azure\"` with a key present but no AZURE_OPENAI_ENDPOINT exported — the value is fetched with `.strip()`, so a whitespace-only variable also triggers it.","commonSituations":"Copy-paste config templates that include the key but not the endpoint; endpoint set under a different name (OPENAI_API_BASE, AZURE_OPENAI_BASE_URL) which this code doesn't read; trailing-quote/whitespace mangled values from .env parsers; deploying to a new environment missing one of the pair.","solutions":["Export the endpoint: `export AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com/` alongside AZURE_OPENAI_API_KEY.","Check for invisible whitespace/newlines — the code strips whitespace but a stray quote stays; verify with `echo \"$AZURE_OPENAI_ENDPOINT\"`.","If you meant plain OpenAI, use `backend=\"openai\"` instead; azure always requires the resource endpoint.","Confirm the URL is your Azure resource URL, not a deployment path or key-vault URI."],"exampleFix":"# before\nexport AZURE_OPENAI_API_KEY=...\n# AZURE_OPENAI_ENDPOINT unset -> ValueError\n\n# after\nexport AZURE_OPENAI_API_KEY=...\nexport AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com/","handlingStrategy":"validation","validationCode":"import os\n\nendpoint = os.environ.get(\"AZURE_OPENAI_ENDPOINT\", \"\").strip()\nif not endpoint.startswith(\"https://\") or \"openai.azure.com\" not in endpoint:\n    raise SystemExit(\"set AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com/\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deploy AZURE_OPENAI_API_KEY and AZURE_OPENAI_ENDPOINT as an inseparable pair.","Log a masked preflight (presence, not value) of both Azure variables before extraction.","Beware .env parsers that leave quotes around values."],"tags":["azure","configuration","environment","api-key"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}