microsoft / microsoft/foundry-local

[Bug] Chat Completions Vision Format Crash

Open
#1,035 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
2.6k
Forks
369
Avg merge
2d 17h
Merged PRs (30d)
39

Description

Describe the issue

Foundry Local's /v1/chat/completions endpoint severely mishandles standard OpenAI-style image_url inputs. Sending an image in the standard Chat Completions shape triggers a massive request-format bug. The engine attempts to allocate tens of gigabytes of memory, immediately crashing the entire engine.

-Impact: The standard /v1/chat/completions endpoint cannot be used for vision tasks.

(Working alternative for this: route the same image through the proprietary /v1/responses endpoint instead, using a distinct input_image field with raw base64 (no data: URI prefix). This works reliably but is undocumented as the required path for vision and isn't OpenAI-compatible, breaking drop-in compatibility with existing OpenAI client code.)

To reproduce

1. Construct a standard OpenAI Chat Completions request with an image supplied via the image_url content-part shape (as used by the official OpenAI SDK and every OpenAI-compatible client).

2. POST it to Foundry Local's /v1/chat/completions endpoint with the vision model loaded.

3. Observe the engine attempting a massive (tens-of-GB) memory allocation and crashing outright this takes down the whole service, not just the request.

4. Working alternative: route the same image through the proprietary /v1/responses endpoint instead, using a distinct input_image field with raw base64 (no data: URI prefix). This works reliably but is undocumented as the required path for vision and isn't OpenAI-compatible, breaking drop-in compatibility with existing OpenAI client code.

Urgency

Medium. Makes the standard/documented endpoint unusable for vision and forces consumers to use an undocumented, proprietary endpoint. But there is also a working alternative.

Platform and architecture

Windows X64

OS Version

Windows 11

Installation type

Released package/binary

Foundry Local version

0.10.2

API or surface area

REST API

Hardware acceleration/backend

CPU

Backend/runtime version

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the standard OpenAI-style image_url request against the /v1/chat/completions endpoint with a vision model on Foundry Local 0.10.2. Compare this with the working /v1/responses input_image path, then trace the REST API request handling. Done means a standard image_url request no longer causes a massive memory allocation or engine crash and remains compatible with OpenAI client formats.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.