{"record":{"id":"5d8f9bd6f6726bd8","repo":"Significant-Gravitas/AutoGPT","slug":"missing-ideogram-api-key","errorCode":null,"errorMessage":"Missing Ideogram API key","messagePattern":"Missing Ideogram API key","errorType":"exception","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"autogpt_platform/backend/backend/api/features/store/image_gen.py","lineNumber":42,"sourceCode":"class ImageStyle(str, Enum):\n    DIGITAL_ART = \"digital art\"\n\n\nasync def generate_agent_image(agent: GraphBaseMeta | AgentGraph) -> io.BytesIO:\n    if settings.config.use_agent_image_generation_v2:\n        return await generate_agent_image_v2(graph=agent)\n    else:\n        return await generate_agent_image_v1(agent=agent)\n\n\nasync def generate_agent_image_v2(graph: GraphBaseMeta | AgentGraph) -> io.BytesIO:\n    \"\"\"\n    Generate an image for an agent using Ideogram model.\n    Returns:\n        str: The URL of the generated image\n    \"\"\"\n    if not ideogram_credentials.api_key:\n        raise ValueError(\"Missing Ideogram API key\")\n\n    from backend.blocks.ideogram import (\n        AspectRatio,\n        ColorPalettePreset,\n        IdeogramModelBlock,\n        IdeogramModelName,\n        MagicPromptOption,\n        StyleType,\n        UpscaleOption,\n    )\n\n    name = graph.name\n    description = f\"{name} ({graph.description})\" if graph.description else name\n\n    prompt = (\n        \"Create a visually striking retro-futuristic vector pop art illustration \"\n        f'prominently featuring \"{name}\" in bold typography. The image clearly and '\n        f\"literally depicts a {description}, along with recognizable objects directly \"","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/Significant-Gravitas/AutoGPT/blob/9c8bb5550f446ba5d3046b78896578742495b3cf/autogpt_platform/backend/backend/api/features/store/image_gen.py#L24-L60","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","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)."],"exampleFix":"// before: key missing, v2 path raises ValueError\n# .env / environment\n# IDEOGRAM_API_KEY=\n\n// after\nIDEOGRAM_API_KEY=<your-ideogram-key>","handlingStrategy":"validation","validationCode":"from backend.util.settings import Settings\n\ndef ideogram_ready() -> bool:\n    return bool(Settings().secrets.ideogram_api_key)  # adjust attr to credentials source","typeGuard":null,"tryCatchPattern":"try:\n    image = await store_image_gen.generate_agent_image(agent=graph)\nexcept ValueError as e:\n    if \"Ideogram\" in str(e):\n        raise HTTPException(503, \"Image generation is not configured\") from e\n    raise","preventionTips":["Add a startup/health check that warns when image-generation keys are missing.","Document which key each generation path (v1 Replicate / v2 Ideogram) requires."],"tags":["store","config","api-key","image-generation"],"backgroundTag":null,"analyzedSha":"9c8bb5550f446ba5d3046b78896578742495b3cf","analyzedAt":"2026-08-14T17:17:21.957Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}