From a9c3b5543550c9c38dd503bfe47df99fe1295dd6 Mon Sep 17 00:00:00 2001 From: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com> Date: Wed, 5 Aug 2026 05:45:47 +0800 Subject: [PATCH] [Refactor] Keep chat template validation out of ServerArgs dispatcher (#33392) Co-authored-by: Alex Nails --- python/sglang/srt/server_args.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index d93983ee0..f9f324ee3 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -3476,13 +3476,6 @@ class ServerArgs: # Validate transcription/ASR-specific server args. self._handle_asr_validation() - if self.default_chat_template_kwargs is not None and not isinstance( - self.default_chat_template_kwargs, dict - ): - raise ValueError( - "--default-chat-template-kwargs must decode to a JSON object" - ) - # Handle deprecated arguments. self._handle_deprecated_args() @@ -8091,6 +8084,12 @@ class ServerArgs: ) def _handle_other_validations(self): + if self.default_chat_template_kwargs is not None and not isinstance( + self.default_chat_template_kwargs, dict + ): + raise ValueError( + "--default-chat-template-kwargs must decode to a JSON object" + ) # Handle optimistic prefill validation if (