vllm-project/vllm · error · ValueError

Cannot set both `pooling_type` and `tok_pooling_type`

Error message

Cannot set both `pooling_type` and `tok_pooling_type`

What it means

PoolerConfig.__post_init__ forbids setting both pooling_type and tok_pooling_type, the tokenwise-specific variant. Same rationale as the seq_pooling_type conflict: pooling_type is a convenience alias that resolves into the specific fields, so specifying both is ambiguous.

Source

Thrown at vllm/config/pooler.py:141

            return data
        if "normalize" in values:
            raise ValueError(
                "Parameter `normalize` was removed; use `use_activation` instead."
            )
        check_removed_pooling_task(values.get("task"))
        return data

    def __post_init__(self) -> None:
        if self.logit_sigma is not None and self.logit_sigma == 0:
            raise ValueError("logit_sigma cannot be 0 (division by zero)")

        if pooling_type := self.pooling_type:
            if self.seq_pooling_type is not None:
                raise ValueError(
                    "Cannot set both `pooling_type` and `seq_pooling_type`"
                )
            if self.tok_pooling_type is not None:
                raise ValueError(
                    "Cannot set both `pooling_type` and `tok_pooling_type`"
                )

            if pooling_type in SEQ_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `seq_pooling_type=%r`.",
                    pooling_type,
                    pooling_type,
                )
                self.seq_pooling_type = pooling_type  # type: ignore[assignment]
            elif pooling_type in TOK_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `tok_pooling_type=%r`.",
                    pooling_type,
                    pooling_type,
                )
                self.tok_pooling_type = pooling_type  # type: ignore[assignment]
            else:

View on GitHub (pinned to c794754062)

Solutions

  1. Drop pooling_type and keep tok_pooling_type (or vice versa).
  2. Regenerate override dicts ensuring only one of the three pooling fields is present.

Example fix

# before
PoolerConfig(pooling_type='STEP', tok_pooling_type='STEP')

# after
PoolerConfig(tok_pooling_type='STEP')
Defensive patterns

Strategy: validation

Validate before calling

def validate_pooler_fields(cfg_kwargs: dict) -> None:
    if cfg_kwargs.get("pooling_type") and cfg_kwargs.get("tok_pooling_type"):
        raise SystemExit("set either pooling_type or tok_pooling_type, not both")

Prevention

When it happens

Trigger: Constructing PoolerConfig(pooling_type='ALL', tok_pooling_type='STEP'), or a config override containing both keys.

Common situations: Token-level reward/classification setups where users set tok_pooling_type explicitly and also pass pooling_type carried over from an older config.

Related errors


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