HKUDS/DeepTutor · error · ValueError
No active image-generation model is configured. Set it in Se
Error message
No active image-generation model is configured. Set it in Settings > Media Generation > Image Generation.
What it means
Raised by resolve_imagegen_runtime_config when the active profile's model entry in the model catalog has no 'model' field (empty/missing model id) for the 'imagegen' category. The resolver refuses to build a generation config without a concrete model name. It is a configuration error, thrown before any provider call.
Source
Thrown at deeptutor/services/config/provider_runtime.py:1085
base_url=api_base,
api_version=_as_str((profile or {}).get("api_version")) or None,
extra_headers=_to_headers((profile or {}).get("extra_headers")),
language=_as_str((model or {}).get("language")) or None,
)
def resolve_imagegen_runtime_config(
catalog: dict[str, Any] | None = None,
*,
service: ModelCatalogService | None = None,
) -> ImagegenConfig:
"""Resolve the active text-to-image config from the model catalog."""
catalog_service = service or get_model_catalog_service()
loaded = _load_catalog(catalog)
profile, model = _active_profile_and_model(loaded, catalog_service, "imagegen")
resolved_model = _as_str((model or {}).get("model"))
if not resolved_model:
raise ValueError(
"No active image-generation model is configured. "
"Set it in Settings > Media Generation > Image Generation."
)
provider = _canonical_generation_provider(
_as_str((profile or {}).get("binding")), IMAGEGEN_PROVIDERS
)
spec = IMAGEGEN_PROVIDERS[provider]
api_base = _as_str((profile or {}).get("base_url")) or spec.default_api_base
api_key = _as_str((profile or {}).get("api_key"))
if not api_key and spec.is_local:
api_key = "sk-no-key-required"
return ImagegenConfig(
model=resolved_model,
provider_name=provider,
adapter=spec.adapter,
auth_style=spec.auth_style,View on GitHub (pinned to 3e82f13042)
Solutions
- Set an active image-generation model in Settings > Media Generation > Image Generation
- Edit the model catalog JSON so the active imagegen profile's model object contains a non-empty 'model' string
- Guard programmatic callers with a pre-check and surface a setup prompt instead of crashing
Example fix
// before
cfg = resolve_imagegen_runtime_config() # ValueError
// after
try:
cfg = resolve_imagegen_runtime_config()
except ValueError as e:
print("configure image model:", e)
raise SystemExit(2) Defensive patterns
Strategy: validation
Validate before calling
def imagegen_configured() -> bool:
try:
resolve_imagegen_runtime_config()
return True
except ValueError:
return False Try / catch
try:
cfg = resolve_imagegen_runtime_config()
except ValueError as e:
if "image-generation model" in str(e):
prompt_user_to_configure("imagegen")
raise Prevention
- Gate image-generation UI/actions behind a config pre-check
- Validate the catalog after migrations: active imagegen profile must have a non-empty model string
When it happens
Trigger: Calling generate_image or the provider test hook (_test_imagegen) when Settings > Media Generation > Image Generation has no active model selected, or the catalog JSON has an imagegen profile whose model object lacks a 'model' key.
Common situations: Fresh install where media generation was never configured; catalog reset/migration wiped the model field; UI allows saving an empty model selection; tests asserting the error path (test_resolve_imagegen_config_raises_without_model).
Related errors
- No active video-generation model is configured. Set it in Se
- PageIndex API key is not configured. Add it under Knowledge
- mcp.configure_command_or_url
- mcp.server_error
- {exc}
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/5cb5878ec6d2d53f.
Report an issue: GitHub.