vllm - 💡(How to fix) Fix SyntaxWarning: invalid escape sequence and spurious trust_remote_code warnings on startup

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Code Example

/opt/vllm-source/vllm/entrypoints/openai/chat_completion/protocol.py:346: SyntaxWarning: invalid escape sequence '\e'
  "(e.g. 'abcdabcdabcd...' or '\emoji \emoji \emoji ...'). This feature "
/opt/vllm-source/vllm/entrypoints/openai/completion/protocol.py:176: SyntaxWarning: invalid escape sequence '\e'
  "(e.g. 'abcdabcdabcd...' or '\emoji \emoji \emoji ...'). This feature "

---

(APIServer pid=1) The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored.
(APIServer pid=1) The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored.
RAW_BUFFERClick to expand / collapse

Bug Description

Two minor issues on every vLLM startup:

1. SyntaxWarning: invalid escape sequence \e

/opt/vllm-source/vllm/entrypoints/openai/chat_completion/protocol.py:346: SyntaxWarning: invalid escape sequence '\e'
  "(e.g. 'abcdabcdabcd...' or '\emoji \emoji \emoji ...'). This feature "
/opt/vllm-source/vllm/entrypoints/openai/completion/protocol.py:176: SyntaxWarning: invalid escape sequence '\e'
  "(e.g. 'abcdabcdabcd...' or '\emoji \emoji \emoji ...'). This feature "

The string literal contains \emoji which Python interprets as an invalid escape sequence. Should be either a raw string (r"...") or use \\emoji.

Files:

  • vllm/entrypoints/openai/chat_completion/protocol.py:346
  • vllm/entrypoints/openai/completion/protocol.py:176

2. Spurious trust_remote_code warning

(APIServer pid=1) The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored.
(APIServer pid=1) The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored.

This warning is printed twice on every startup when --trust-remote-code is passed, even for models that DO use custom code (e.g., Qwen3-MoE). The warning comes from HuggingFace transformers when trust_remote_code is passed to a non-Auto class. vLLM should either suppress this warning or not pass the flag to classes that don't need it.

Environment

  • vLLM version: 0.17.1 (via ghcr.io/llm-d/llm-d-cuda:v0.6.0)
  • Python 3.12
  • Model: RedHatAI/Qwen3-30B-A3B-FP8-dynamic (reproduces with any model)

Impact

Low severity — these are cosmetic warnings that don't affect functionality. However, they clutter logs and can confuse users running automated log analysis. The SyntaxWarning will become a SyntaxError in a future Python version.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - 💡(How to fix) Fix SyntaxWarning: invalid escape sequence and spurious trust_remote_code warnings on startup