kestra-io / kestra-io/plugin-ai

DockerModel provider fails image generation with a field required error from Docker Model Runner

Open
#390 0 comments 0 reactions 0 assignees View on GitHub
area/plugin
Dominant language
Java
Stars
9
Forks
24
Avg merge
1d 23h
Merged PRs (30d)
15

Description

### Describe the issue

The DockerModel provider works for chat completion and embeddings, but image generation always fails. An ImageGeneration task using DockerModel with a diffuser model such as ai/stable-diffusion returns this error every time:

{"detail":[{"type":"missing","loc":["body"],"msg":"Field required","input":null}]}

The request body sent by the provider is well formed and works fine when sent with a plain HTTP/1.1 client such as curl. The difference is that the provider's HTTP client also sends cleartext HTTP/2 upgrade headers (Connection: Upgrade, HTTP2-Settings and Upgrade: h2c) with the request. Docker Model Runner's diffusers backend loses the request body when it sees those upgrade headers, while the same headers cause no problem against the chat and embedding backend. Forcing the client to plain HTTP/1.1, or stripping the upgrade headers, makes image generation work.

### Visuals and Reproducibility

1. Deploy the flow below and run it.
2. Open the execution and check the Logs tab on the generate task.
3. The task fails with the field required error above instead of returning an image URL.

```yaml
id: image_generation_docker_model
namespace: docker.modelrunner

tasks:
- id: generate
type: io.kestra.plugin.ai.completion.ImageGeneration
prompt: "A cute red panda sitting on a tree branch, digital art"
provider:
type: io.kestra.plugin.ai.provider.DockerModel
modelName: ai/stable-diffusion
baseUrl: http://model-runner.docker.internal/engines/v1

- id: log_result
type: io.kestra.plugin.core.log.Log
message: "imageUrl={{ outputs.generate.imageUrl }} finishReason={{ outputs.generate.finishReason }}"
```

### Environment

Kestra Version: 2.0 develop
plugin-ai plugin version: 1.15.0
Docker Model Runner Version: 1.2.6

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the DockerModel provider's ImageGeneration request path and inspect how its HTTP client handles cleartext HTTP/2 upgrade headers. Reproduce with the supplied image_generation_docker_model flow using ai/stable-diffusion, then verify that the task returns an image URL when the request is sent without those headers.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
ai, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.