From ccb8e0db00fc0733d7b8a90cac765968c62a68ec Mon Sep 17 00:00:00 2001 From: wayne-o Date: Wed, 1 Apr 2026 10:52:31 +0200 Subject: [PATCH] fix: add missing return in load_model_with_fallback When `mlx_lm.load()` succeeds without raising a `ValueError`, `load_model_with_fallback()` falls through the try/except block without returning the (model, tokenizer) tuple, causing the caller to receive `None` and crash with: TypeError: cannot unpack non-iterable NoneType object This affects all models that load successfully on the first try (i.e., most models that don't need the Nemotron/vision fallback paths). Co-Authored-By: Claude Opus 4.6 (1M context) --- vllm_mlx/utils/tokenizer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vllm_mlx/utils/tokenizer.py b/vllm_mlx/utils/tokenizer.py index a50883951..aaaeae550 100644 --- a/vllm_mlx/utils/tokenizer.py +++ b/vllm_mlx/utils/tokenizer.py @@ -52,6 +52,7 @@ def load_model_with_fallback(model_name: str, tokenizer_config: dict = None): try: model, tokenizer = load(model_name, tokenizer_config=tokenizer_config) + return model, tokenizer except ValueError as e: # Fallback for models with non-standard tokenizers if "TokenizersBackend" in str(e) or "Tokenizer class" in str(e):