Skip to content

[Bugfix] Return 400 for Qwen image edit validation errors#2930

Closed
david6666666 wants to merge 2 commits into
vllm-project:mainfrom
david6666666:codex/issue-2886-pr2840-http400-main
Closed

[Bugfix] Return 400 for Qwen image edit validation errors#2930
david6666666 wants to merge 2 commits into
vllm-project:mainfrom
david6666666:codex/issue-2886-pr2840-http400-main

Conversation

@david6666666
Copy link
Copy Markdown
Collaborator

Summary

  • harden /v1/images/edits multi-image validation so the server only trusts concrete diffusion capability metadata
  • map worker-side Qwen image-edit input-limit validation failures back to 400 Bad Request instead of surfacing them as 500
  • re-enable the ComfyUI image-to-image DALL-E integration case and add API regressions for this path

Root Cause

Issue #2886 is a real code regression introduced around #2840 rather than a bad test.

PR #2840 added early multi-image validation for Qwen image edit requests, but the serving layer assumed that od_config.supports_multimodal_inputs and od_config.max_multimodal_image_inputs were always concrete bool / int values. In compatibility and mocked surfaces such as the ComfyUI integration tests, those attributes can be absent or represented by non-concrete placeholder objects. That made the pre-check brittle and allowed invalid exceptions to escape as internal server errors.

There was also still a second failure mode where a deeper worker-side validation error like Received 5 input images... could bubble up as a generic 500, even though it is fundamentally a request validation problem and should be reported as 400.

Why This Fix

  • keep the API server model-agnostic and compatible with the existing diffusion metadata plumbing
  • avoid rejecting requests based on non-concrete compatibility placeholders
  • preserve the user-facing contract that invalid image-edit input counts are client errors (400) rather than server errors (500)
  • restore the previously skipped ComfyUI regression coverage instead of leaving the case disabled

Validation

  • pytest -q tests/entrypoints/openai_api/test_image_server.py
  • pytest -q tests/comfyui/test_comfyui_integration.py
  • pre-commit run --all-files
  • E2E serve + curl against local Qwen-Image-Edit-2511

Test Result

  • tests/entrypoints/openai_api/test_image_server.py: 53 passed
  • tests/comfyui/test_comfyui_integration.py: 18 passed
  • pre-commit run --all-files: passed
  • E2E on local Qwen-Image-Edit-2511:
    • 5-image /v1/images/edits request returned 400 with Received 5 input images. At most 4 images are supported by this model.
    • 1-image /v1/images/edits request returned 200 with a valid b64_json image payload

Fixes #2886.

Signed-off-by: david6666666 <530634352@qq.com>
@david6666666 david6666666 marked this pull request as ready for review April 20, 2026 02:47
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown
Collaborator

@SamitHuang SamitHuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR addresses the immediate regression by hardening config checks and adding tests. However, there are two issues to resolve. First, vllm_omni/entrypoints/openai/serving_chat.py contains a similar getattr(od_config, "supports_multimodal_inputs", False) pattern that may also fail with non-concrete configs. Second, relying on regex and string matching to parse worker exceptions is brittle and fixes a symptom rather than the root cause.

logger.error(f"Validation error: {e}")
raise HTTPException(status_code=HTTPStatus.BAD_REQUEST.value, detail=str(e))
except Exception as e:
image_input_validation_detail = _extract_image_input_validation_detail(e)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relying on regex and string matching of the RuntimeError message is brittle and fixes the symptom rather than the root cause. Please consider raising a specific validation exception type (e.g., ValueError or a custom InputValidationError) from the worker or engine layer so the API layer can catch it cleanly without parsing strings.

return None

if not bool(getattr(od_config, "supports_multimodal_inputs", False)):
supports_multimodal_inputs = _normalize_optional_bool(getattr(od_config, "supports_multimodal_inputs", None))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed a similar pattern exists in vllm_omni/entrypoints/openai/serving_chat.py (around line 2174) where getattr(od_config, "supports_multimodal_inputs", False) is used. If that code path can also be hit with mocked or non-concrete configs during testing or ComfyUI integration, it will suffer from the same bug. Please apply _normalize_optional_bool there as well if applicable.

Signed-off-by: david6666666 <530634352@qq.com>
@david6666666 david6666666 marked this pull request as draft April 20, 2026 08:35
@david6666666
Copy link
Copy Markdown
Collaborator Author

wait for #2426

Copy link
Copy Markdown
Collaborator

@hsliuustc0106 hsliuustc0106 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKER scan: PASS

Good fix with proper error handling and comprehensive tests. The serialized error type approach preserves error information across the pipeline while avoiding brittle validation assumptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready label to trigger buildkite CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI Failure]: ComfyUI image-to-image DALL-E endpoint cases

4 participants