{"record":{"id":"642e9cc9fced85de","repo":"ATH-MaaS/Pixelle-Video","slug":"video-workflow-used-please-use-media-generate-en","errorCode":null,"errorMessage":"Video workflow used. Please use /media/generate endpoint for video generation.","messagePattern":"Video workflow used\\. Please use /media/generate endpoint for video generation\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"api/routers/image.py","lineNumber":56,"sourceCode":"    - **height**: Image height (512-2048)\n    - **workflow**: Optional custom workflow filename\n    \n    Returns path to generated image.\n    \"\"\"\n    try:\n        logger.info(f\"Image generation request: {request.prompt[:50]}...\")\n        \n        # Call media service (backward compatible with image API)\n        media_result = await pixelle_video.media(\n            prompt=request.prompt,\n            width=request.width,\n            height=request.height,\n            workflow=request.workflow\n        )\n        \n        # For backward compatibility, only support image results in /image endpoint\n        if media_result.is_video:\n            raise HTTPException(\n                status_code=400,\n                detail=\"Video workflow used. Please use /media/generate endpoint for video generation.\"\n            )\n        \n        return ImageGenerateResponse(\n            image_path=media_result.url\n        )\n        \n    except HTTPException:\n        raise\n    except Exception as e:\n        logger.error(f\"Image generation error: {e}\")\n        raise HTTPException(status_code=500, detail=str(e))\n\n","sourceCodeStart":38,"sourceCodeEnd":71,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/api/routers/image.py#L38-L71","documentation":"The /image/generate endpoint intentionally rejects requests whose selected workflow produces video. The pixelle media service returns a result flagged is_video, and the router raises 400 telling the caller to switch to /media/generate. This is a deliberate backward-compatibility guard, not a bug: the old /image endpoint now only supports image workflows.","triggerScenarios":"POST /image/generate with a request whose 'workflow' field names a video workflow (or one that resolves to a video pipeline), so media_result.is_video is True.","commonSituations":"Clients upgraded from older API versions where /image accepted any workflow; copying a video-generation payload into the image endpoint; workflow name typo that maps to a video template; following outdated documentation.","solutions":["Change the workflow field in the request to an image workflow, or","Send the same request to POST /media/generate instead, which accepts both image and video workflows","Update client code/docs that still route video workflows to /image/generate"],"exampleFix":"// before\nPOST /image/generate {\"workflow\": \"text_to_video\", ...}\n// after\nPOST /media/generate {\"workflow\": \"text_to_video\", ...}","handlingStrategy":"validation","validationCode":"// client-side guard before calling /image/generate\nconst IMAGE_WORKFLOWS = new Set(['image_default', 'text_to_image' /* keep in sync with GET /workflows/image */]);\nif (!IMAGE_WORKFLOWS.has(request.workflow)) {\n  return callMediaGenerate(request); // route video workflows elsewhere\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await imageGenerate(request);\n} catch (err) {\n  if (err.status === 400 && /media\\/generate/.test(err.message)) {\n    return await mediaGenerate(request); // auto-migrate to correct endpoint\n  }\n  throw err;\n}","preventionTips":["Fetch GET /workflows/image (or /workflows/media) at startup and route by workflow type","Never hardcode video workflow names into image requests","Update old integration code that predates the /media/generate endpoint","Check HTTP 400 detail for the redirect hint instead of retrying blindly"],"tags":["http-400","api-migration","wrong-endpoint","backward-compatibility"],"backgroundTag":"wrong-endpoint-for-workflow","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}