Significant-Gravitas/AutoGPT · error · ValueError
Missing Ideogram API key
Error message
Missing Ideogram API key
What it means
ValueError raised in generate_agent_image_v2() when the Ideogram credentials object has an empty/None api_key. It is a hard precondition: the v2 image-generation path (chosen when the deployment uses Ideogram) refuses to run without the key, and the ValueError then propagates (typically wrapped by the route into a 500/400 depending on handlers).
Source
Thrown at autogpt_platform/backend/backend/api/features/store/image_gen.py:42
class ImageStyle(str, Enum):
DIGITAL_ART = "digital art"
async def generate_agent_image(agent: GraphBaseMeta | AgentGraph) -> io.BytesIO:
if settings.config.use_agent_image_generation_v2:
return await generate_agent_image_v2(graph=agent)
else:
return await generate_agent_image_v1(agent=agent)
async def generate_agent_image_v2(graph: GraphBaseMeta | AgentGraph) -> io.BytesIO:
"""
Generate an image for an agent using Ideogram model.
Returns:
str: The URL of the generated image
"""
if not ideogram_credentials.api_key:
raise ValueError("Missing Ideogram API key")
from backend.blocks.ideogram import (
AspectRatio,
ColorPalettePreset,
IdeogramModelBlock,
IdeogramModelName,
MagicPromptOption,
StyleType,
UpscaleOption,
)
name = graph.name
description = f"{name} ({graph.description})" if graph.description else name
prompt = (
"Create a visually striking retro-futuristic vector pop art illustration "
f'prominently featuring "{name}" in bold typography. The image clearly and '
f"literally depicts a {description}, along with recognizable objects directly "View on GitHub (pinned to 9c8bb5550f)
Solutions
- Set the Ideogram API key in backend settings/secrets (env var per backend/.env.default naming) for the environment running image generation.
- Restart/redeploy the backend so Settings picks up the new value.
- If Ideogram is not available, disable the v2 path so the code falls back to generate_agent_image_v1 (which needs the Replicate key instead).
Example fix
// before: key missing, v2 path raises ValueError # .env / environment # IDEOGRAM_API_KEY= // after IDEOGRAM_API_KEY=<your-ideogram-key>
Defensive patterns
Strategy: validation
Validate before calling
from backend.util.settings import Settings
def ideogram_ready() -> bool:
return bool(Settings().secrets.ideogram_api_key) # adjust attr to credentials source Try / catch
try:
image = await store_image_gen.generate_agent_image(agent=graph)
except ValueError as e:
if "Ideogram" in str(e):
raise HTTPException(503, "Image generation is not configured") from e
raise Prevention
- Add a startup/health check that warns when image-generation keys are missing.
- Document which key each generation path (v1 Replicate / v2 Ideogram) requires.
When it happens
Trigger: POST to the agent-image generation endpoint on a deployment flagged for v2 while IDEOGRAM_API_KEY is unset/empty in the backend settings/secrets (env var missing in docker-compose, .env not loaded, or secret not provisioned in the deployed environment).
Common situations: New environment bootstrap where only the Replicate key was configured; v1→v2 rollout toggled before secrets were added; local dev copying .env.default without adding the Ideogram key.
Related errors
- Missing Replicate API key in settings
- Invalid Replicate API token
- Unexpected output format from the model.
- Image generation failed: {str(e)}
- GCS media bucket is not configured
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/5d8f9bd6f6726bd8.
Report an issue: GitHub.