vllm-project/vllm · error · ValueError

tokenizer must be a string, got {type(self.tokenizer).__name

Error message

tokenizer must be a string, got {type(self.tokenizer).__name__}: {self.tokenizer!r}. Please provide a valid tokenizer path or HuggingFace model ID.

What it means

Error "tokenizer must be a string, got {type(self.tokenizer).__name__}: {self.tokenizer!r}. Please provide a valid tokenizer path or HuggingFace model ID." thrown in vllm-project/vllm.

Source

Thrown at vllm/config/model.py:918

            return value
        return handler(value)

    @field_validator("tokenizer_mode", mode="after")
    def _lowercase_tokenizer_mode(cls, tokenizer_mode: str) -> str:
        return tokenizer_mode.lower()

    @field_validator("quantization", mode="before")
    @classmethod
    def validate_quantization_before(cls, value: Any) -> Any:
        if isinstance(value, str):
            return value.lower()
        return value

    @model_validator(mode="after")
    def validate_model_config_after(self: "ModelConfig") -> "ModelConfig":
        """Called after __post_init__"""
        if not isinstance(self.tokenizer, str):
            raise ValueError(
                f"tokenizer must be a string, got "
                f"{type(self.tokenizer).__name__}: {self.tokenizer!r}. "
                "Please provide a valid tokenizer path or HuggingFace model ID."
            )
        if not isinstance(self.max_model_len, int) or self.max_model_len < 1:
            raise ValueError(
                f"max_model_len must be a positive integer, "
                f"got {type(self.max_model_len).__name__}: {self.max_model_len!r}. "
                "Example: max_model_len=2048"
            )
        return self

    def _resolve_mm_device_do_normalize(
        self, mm_device_do_normalize: bool | None
    ) -> bool:
        if mm_device_do_normalize is None:
            if envs.VLLM_USE_RUST_FRONTEND:
                logger.debug(

View on GitHub (pinned to c794754062)

Solutions

  1. Pass the tokenizer as a string path or HuggingFace model ID, not an object.

When it happens

Trigger: Raised at vllm/config/model.py:918 when validation fails: tokenizer must be a string (valid tokenizer path or HuggingFace model ID). Typically triggered by an incompatible or incomplete vLLM configuration, an unsupported platform/backend combination, or a runtime resource/dependency that is missing.

Common situations: Commonly encountered at vllm/config/model.py:918 during vLLM startup/config validation or runtime setup when: (1) conflicting CLI flags or config fields are combined, (2) the current platform (CUDA/ROCm/CPU/XPU) or installed optional packages do not support the requested feature, or (3) a required value is absent or out of range. Resolve by correcting the configuration as described in the message, or by selecting a supported alternative.


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/0e2e4d26df5ccac6. Report an issue: GitHub.