{"record":{"id":"94850319200c57dd","repo":"HKUDS/DeepTutor","slug":"no-endpoint-url-configured-for-image-generation-948503","errorCode":null,"errorMessage":"No endpoint URL configured for image generation.","messagePattern":"No endpoint URL configured for image generation\\.","errorType":"error_code","errorClass":"GenerationProviderError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/imagegen/adapters/openai_compat.py","lineNumber":37,"sourceCode":"    GenerationProviderError,\n    build_auth_headers,\n    join_api_path,\n    raise_for_provider,\n)\nfrom deeptutor.services.imagegen.base import BaseImagegenAdapter\nfrom deeptutor.services.imagegen.config import ImagegenConfig\n\nlogger = logging.getLogger(__name__)\n\n\nclass OpenAICompatImagegenAdapter(BaseImagegenAdapter):\n    \"\"\"POST ``{base}/images/generations`` with a JSON body, returning image bytes.\"\"\"\n\n    async def generate(\n        self, prompt: str, config: ImagegenConfig, *, n: int = 1\n    ) -> list[tuple[bytes, str]]:\n        if not config.base_url:\n            raise GenerationProviderError(\"No endpoint URL configured for image generation.\")\n        url = join_api_path(config.base_url, \"images/generations\")\n        headers = {\n            \"Content-Type\": \"application/json\",\n            **build_auth_headers(config.auth_style, config.api_key),\n            **(config.extra_headers or {}),\n        }\n        payload: dict[str, Any] = {\"model\": config.model, \"prompt\": prompt, \"n\": max(1, n)}\n        if config.size:\n            payload[\"size\"] = config.size\n        if config.quality:\n            payload[\"quality\"] = config.quality\n        if config.style:\n            payload[\"style\"] = config.style\n        if config.response_format:\n            payload[\"response_format\"] = config.response_format\n\n        logger.debug(\n            \"imagegen url=%s model=%s n=%d size=%s\", url, config.model, max(1, n), config.size","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/imagegen/adapters/openai_compat.py#L19-L55","documentation":"Raised by OpenAICompatImagegenAdapter.generate when ImagegenConfig.base_url is empty. The adapter POSTs to join_api_path(config.base_url, 'images/generations'), so an empty base URL leaves no endpoint to call.","triggerScenarios":"Calling generate() on the OpenAI-compatible adapter with base_url None/'' — typically a provider settings entry missing the base URL, or the env var feeding it unset.","commonSituations":"Missing env var for the imagegen API host, typo in settings JSON, switching providers without updating the base URL field.","solutions":["Set base_url (e.g. https://api.openai.com/v1) on the ImagegenConfig before calling generate","Verify the provider config in data/user/settings/*.json or env includes the base URL","Confirm the chosen provider actually exposes POST {base}/images/generations"],"exampleFix":"// before\nconfig = ImagegenConfig(base_url=\"\", api_key=key)\n// after\nconfig = ImagegenConfig(base_url=\"https://api.openai.com/v1\", api_key=key)","handlingStrategy":"validation","validationCode":"if not config.base_url:\n    raise ValueError(\"Set ImagegenConfig.base_url (e.g. https://api.openai.com/v1) before generate()\")","typeGuard":"def is_configured(config) -> bool:\n    return bool(getattr(config, \"base_url\", None))","tryCatchPattern":null,"preventionTips":["Validate required provider fields when building ImagegenConfig","Add a startup smoke check that imagegen provider settings are complete"],"tags":["imagegen","configuration","missing-base-url"],"backgroundTag":"missing-endpoint-url","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}