{"record":{"id":"b8842e893c3cef29","repo":"sgl-project/sglang","slug":"an-input-image-is-required-for-mesh-generation","errorCode":null,"errorMessage":"An input image is required for mesh generation","messagePattern":"An input image is required for mesh generation","errorType":"http","errorClass":"HTTPException","httpStatus":422,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/openai/mesh_api.py","lineNumber":208,"sourceCode":"            body = {}\n        try:\n            payload: Dict[str, Any] = dict(body or {})\n\n            if payload.get(\"input_image\"):\n                img_src = payload.pop(\"input_image\")\n                uploads_dir = os.path.join(\"outputs\", \"uploads\")\n                os.makedirs(uploads_dir, exist_ok=True)\n                input_path = await save_image_to_path(\n                    img_src,\n                    os.path.join(uploads_dir, f\"{request_id}_input_image\"),\n                )\n\n            req = MeshGenerationsRequest(**payload)\n        except Exception as e:\n            raise HTTPException(status_code=400, detail=f\"Invalid request body: {e}\")\n\n    if not input_path:\n        raise HTTPException(\n            status_code=422,\n            detail=\"An input image is required for mesh generation\",\n        )\n\n    sampling_params = _build_sampling_params_from_request(request_id, req, input_path)\n    job = _mesh_job_from_sampling(request_id, req, sampling_params)\n    await MESH_STORE.upsert(request_id, job)\n\n    batch = prepare_request(\n        server_args=server_args,\n        sampling_params=sampling_params,\n    )\n\n    asyncio.create_task(_dispatch_job_async(request_id, batch))\n    return MeshResponse(**job)\n\n\n@router.get(\"\", response_model=MeshListResponse)","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/openai/mesh_api.py#L190-L226","documentation":"The mesh generation endpoint requires an input image; if after processing the request no input_path was produced, it returns HTTP 422. This guards the core invariant that mesh generation is image-conditioned.","triggerScenarios":"Calling the mesh generations endpoint without any image: no multipart file part and no valid image source in the JSON payload.","commonSituations":"Client sends only a prompt JSON body; form-data field named 'image' missing or empty; sending the image under an unexpected field name so the server never reads it.","solutions":["Attach the input image as the expected multipart file field (or provide a valid image source in JSON)","Confirm the field name matches what the endpoint expects (img/img_src/image)","If testing with curl, use -F to send the file as multipart form-data"],"exampleFix":"// before\ncurl -X POST url -H 'Content-Type: application/json' -d '{\"prompt\":\"mesh\"}'\n// after\ncurl -X POST url -F \"image=@input.png\" -F \"prompt=generate 3d mesh\"","handlingStrategy":"validation","validationCode":"has_image = file is not None or body.get('image') is not None\nassert has_image, 'mesh generation requires an image'","typeGuard":null,"tryCatchPattern":"if resp.status_code == 422: attach the image file and retry","preventionTips":["Always attach the image file with the expected field name","Treat 422 as a client bug, not transient"],"tags":["http","missing-parameter","mesh-generation","unprocessable-entity"],"backgroundTag":"missing-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}