{"record":{"id":"1d3a5b1844b34e61","repo":"vllm-project/vllm","slug":"tok-pooling-type-is-not-set-it-should-be-resolved","errorCode":null,"errorMessage":"tok_pooling_type is not set; it should be resolved by ModelConfig before calling get_tok_pooling_type()","messagePattern":"tok_pooling_type is not set; it should be resolved by ModelConfig before calling get_tok_pooling_type\\(\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/config/pooler.py","lineNumber":172,"sourceCode":"                    \"Resolved `pooling_type=%r` to `tok_pooling_type=%r`.\",\n                    pooling_type,\n                    pooling_type,\n                )\n                self.tok_pooling_type = pooling_type  # type: ignore[assignment]\n            else:\n                raise NotImplementedError(pooling_type)\n\n    def get_seq_pooling_type(self) -> SequencePoolingType:\n        if self.seq_pooling_type is None:\n            raise ValueError(\n                \"seq_pooling_type is not set; it should be resolved by\"\n                \" ModelConfig before calling get_seq_pooling_type()\"\n            )\n        return self.seq_pooling_type\n\n    def get_tok_pooling_type(self) -> TokenPoolingType:\n        if self.tok_pooling_type is None:\n            raise ValueError(\n                \"tok_pooling_type is not set; it should be resolved by\"\n                \" ModelConfig before calling get_tok_pooling_type()\"\n            )\n        return self.tok_pooling_type\n\n    def compute_hash(self) -> str:\n        \"\"\"\n        WARNING: Whenever a new field is added to this config,\n        ensure that it is included in the factors list if\n        it affects the computation graph.\n\n        Provide a hash that uniquely identifies all the configs\n        that affect the structure of the computation\n        graph from input ids/embeddings to the final hidden states,\n        excluding anything before input ids/embeddings and after\n        the final hidden states.\n        \"\"\"\n        # no factors to consider.","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/config/pooler.py#L154-L190","documentation":"Tokenwise counterpart of get_seq_pooling_type: PoolerConfig.get_tok_pooling_type() raises when tok_pooling_type is None, meaning ModelConfig resolution (which decides between sequence and tokenwise pooling, e.g. for reward models) never populated it. Indicates the getter was called on an unresolved or sequence-only config.","triggerScenarios":"Calling get_tok_pooling_type() on a PoolerConfig that was never run through ModelConfig resolution, or on a config for a sequence-pooling model where tok_pooling_type legitimately stays None.","commonSituations":"Token-classification/reward model code paths calling the getter before model config resolution; tests constructing PoolerConfig() directly.","solutions":["Set tok_pooling_type explicitly ('ALL' or 'STEP') for direct construction.","Route through ModelConfig so resolution assigns it based on the model's task.","Check pooler_config.task / model type before assuming tokenwise pooling applies."],"exampleFix":"# before\ncfg = PoolerConfig()\nt = cfg.get_tok_pooling_type()  # raises\n\n# after\ncfg = PoolerConfig(tok_pooling_type='ALL')\nt = cfg.get_tok_pooling_type()","handlingStrategy":"validation","validationCode":"def get_tok_type_or_default(cfg, default: str = \"ALL\") -> str:\n    return cfg.tok_pooling_type if cfg.tok_pooling_type is not None else default","typeGuard":"def has_tok_pooling(cfg) -> bool:\n    return cfg.tok_pooling_type is not None","tryCatchPattern":"try:\n    ptype = cfg.get_tok_pooling_type()\nexcept ValueError:\n    ptype = \"ALL\"  # or ensure ModelConfig resolution ran first","preventionTips":["Construct PoolerConfig with explicit tok_pooling_type in unit tests that call the getter.","Confirm the model's task is token-level (e.g. reward/PRM) before requiring tok pooling."],"tags":["pooling","internal-contract","api-misuse"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}