Skip to content

/v1/chat/completions returns 400 for the OpenAI developer role #646

Open

Description

@gdevenyi

/v1/chat/completions passes message roles through unchanged, so a developer message (sent by Codex and other current OpenAI clients) reaches apply_chat_template. Qwen3.8-Flash-Next's template raises Unexpected message role., which comes back as 400 could not encode request: Unexpected message role.. /v1/responses already folds developer into the system message (server/responses_api.py:263). The same error was reported in #376 for another model; that issue is closed and main still fails.

from transformers import AutoTokenizer
t = AutoTokenizer.from_pretrained("nvidia/Qwen3.8-Flash-Next-NVFP4")
t.apply_chat_template([{"role": "developer", "content": "Answer in French."},
                       {"role": "user", "content": "hi"}], tokenize=False)
# TemplateError: Unexpected message role.   (role "system" renders)

Expected: developer is treated as system on /v1/chat/completions when the template has no developer role, as on /v1/responses.

Environment: main 07813248, transformers 5.15.1, Python 3.14.

Implementation: #391 maps the developer role. On my fork, two follow-ups keep templates that require a leading system message working:

  • 6d1f0ad: merge developer messages into the leading system message after mapping them.
  • beade07: keep developer ahead of system, and reject images when merging system messages.

Activity

  1. gdevenyi commented on Oct 13, 2026

    @gdevenyi
    ContributorAuthor

    Tested in the 1080 Ti deployment branch, rebuilt today on main 9c635a1 (torch 2.14.1+cu126, Triton 3.8, GTX 1080 Ti sm_61, Qwen3.8-Flash-Next-NVFP4 at 262K): main's tokenizer-side merge of mapped developer messages is in, plus the server-side ordering/image check (tests/tokenizer/test_tokenize.py, tests/server/test_mm_input.py pass).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions