{"record":{"id":"b1b96fd4938b6396","repo":"odysseus-dev/odysseus","slug":"no-image-generation-endpoint-configured-add-one-i","errorCode":null,"errorMessage":"No image generation endpoint configured. Add one in Settings → Add Models.","messagePattern":"No image generation endpoint configured\\. Add one in Settings → Add Models\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/gallery/gallery_routes.py","lineNumber":582,"sourceCode":"\n        user = require_privilege(request, \"can_generate_images\")\n        form = await request.form()\n        file = form.get(\"image\")\n        if not file: raise HTTPException(400, \"No image\")\n        scale = int(form.get(\"scale\", \"2\"))\n\n        image_bytes = await read_upload_limited(file, GALLERY_TRANSFORM_UPLOAD_MAX_BYTES, \"Image upload\")\n        b64 = base64.b64encode(image_bytes).decode()\n\n        # Find image endpoint\n        db = SessionLocal()\n        try:\n            ep = _first_visible_image_endpoint(db, user)\n        finally:\n            db.close()\n\n        if not ep:\n            raise HTTPException(400, \"No image generation endpoint configured. Add one in Settings → Add Models.\")\n\n        base_url = ep.base_url.rstrip(\"/\")\n        if not base_url.endswith(\"/v1\"):\n            base_url += \"/v1\"\n\n        # Use img2img endpoint if available, otherwise upscale via canvas on client\n        try:\n            async with httpx.AsyncClient(timeout=120) as client:\n                resp = await client.post(f\"{base_url}/images/upscale\", json={\n                    \"image\": b64, \"scale\": scale,\n                })\n                if resp.status_code == 200:\n                    data = resp.json()\n                    return {\"image\": data.get(\"data\", [{}])[0].get(\"b64_json\", \"\")}\n                # Fallback: no upscale endpoint — return error\n                return {\"error\": f\"Upscale endpoint not available ({resp.status_code})\"}\n        except Exception:\n            logger.exception(\"ai_upscale: request failed\")","sourceCodeStart":564,"sourceCodeEnd":600,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/gallery/gallery_routes.py#L564-L600","documentation":"HTTP 400 raised by POST /api/gallery/ai-upscale when _first_visible_image_endpoint(db, user) returns no configured image-generation endpoint. The server needs a diffusion backend (base_url ending in /v1) to proxy the upscale to {base_url}/images/upscale; with none configured for this user it refuses before any network call.","triggerScenarios":"Fresh install with no model endpoints added; endpoints exist but are hidden from this user via visibility rules; endpoints filtered out because their type is not image generation.","commonSituations":"New deployments skipping the Settings setup step; per-user endpoint visibility; after deleting a misconfigured endpoint and forgetting to re-add one.","solutions":["Add an image-generation endpoint in Settings → Add Models with its base_url.","Verify the endpoint is visible to the requesting user, not just the admin.","Confirm the endpoint type is image generation so the visibility filter matches.","Check the base_url reaches the diffusion server's /v1 API."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const configured = await getVisibleImageEndpoints();\nif (configured.length === 0) showSetupGuide('Add an image model in Settings → Add Models');","typeGuard":"const hasImageEndpoint = (eps) => Array.isArray(eps) && eps.some(e => e.type === 'image');","tryCatchPattern":"try { await upscale(fd); } catch (e) { if (e.status === 400 && /endpoint configured/.test(e.message)) openSettings(); }","preventionTips":["Complete model setup during onboarding","Verify endpoint visibility per user","Health-check configured endpoints before showing AI actions"],"tags":["http","configuration","gallery","upscale","endpoint"],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}