{"record":{"id":"dbec789421794b86","repo":"vllm-project/vllm","slug":"online-shorthand-v-r-does-not-define-a-field-na","errorCode":null,"errorMessage":"online shorthand {v!r} does not define a {field_name} spec","messagePattern":"online shorthand (.+?) does not define a (.+?) spec","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/config/quantization.py","lineNumber":107,"sourceCode":"    \"\"\"Spec applied to ``LinearBase`` layers.\"\"\"\n\n    moe: QuantSpec | None = None\n    \"\"\"Spec applied to ``FusedMoEFactory`` layers.\"\"\"\n\n    ignore: list[str] = Field(default_factory=list)\n    \"\"\"Layers to skip quantization for.\"\"\"\n\n    @field_validator(\"linear\", \"moe\", mode=\"before\")\n    @classmethod\n    def _coerce_spec(cls, v: Any, info: ValidationInfo) -> Any:\n        if not isinstance(v, str):\n            return v\n        field_name = info.field_name\n        assert field_name is not None\n        if v in _ONLINE_SHORTHANDS:\n            spec = getattr(_ONLINE_SHORTHANDS[v], field_name)\n            if spec is None:\n                raise ValueError(\n                    f\"online shorthand {v!r} does not define a {field_name} spec\"\n                )\n            return spec\n        return QuantSpec(weight=_coerce_quant_key(v))\n\n\n# CLI shorthands accepted by `--quantization`. Each desugars to a full\n# QuantizationConfigArgs; activation overrides go through quantization_config.\n_ONLINE_SHORTHANDS: dict[str, QuantizationConfigArgs] = {\n    \"fp8_per_tensor\": QuantizationConfigArgs(\n        linear=QuantSpec(weight=kFp8StaticTensorSym),\n        moe=QuantSpec(weight=kFp8StaticTensorSym),\n    ),\n    \"fp8_per_block\": QuantizationConfigArgs(\n        linear=QuantSpec(weight=kFp8Static128BlockSym),\n        moe=QuantSpec(weight=kFp8Static128BlockSym),\n    ),\n    # Per-output-channel weight scale + dynamic per-token activation.","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/config/quantization.py#L89-L125","documentation":"QuantizationConfigArgs coerces string values on its linear/moe fields via _coerce_spec. When the string matches an _ONLINE_SHORTHANDS preset, the preset's corresponding field is copied; if that preset leaves this field None (it does not define a linear or moe spec), this ValueError fires. It means you applied a shorthand that only quantizes the other layer type.","triggerScenarios":"Setting QuantizationConfigArgs(moe='<shorthand>') where the shorthand in _ONLINE_SHORTHANDS was built with moe=None (e.g. an activation-only or linear-only preset), or vice versa for linear.","commonSituations":"Using a new online shorthand that only covers linear layers and applying it to the moe field; assuming every shorthand defines both linear and moe specs.","solutions":["Use the shorthand at the top level (--quantization / the quantization field) so the preset's own field mapping is respected","For the field that is None in the preset, supply an explicit QuantKey string (e.g. 'fp8_static_tensor_sym') instead of the shorthand","Check _ONLINE_SHORTHANDS in vllm/config/quantization.py to see which fields each preset defines before referencing it per-field"],"exampleFix":"# before\nQuantizationConfigArgs(moe='some_linear_only_shorthand')\n\n# after\nQuantizationConfigArgs(moe='fp8_static_tensor_sym')","handlingStrategy":"validation","validationCode":"from vllm.config.quantization import _ONLINE_SHORTHANDS\n\ndef shorthand_covers(field: str, name: str) -> bool:\n    return getattr(_ONLINE_SHORTHANDS[name], field) is not None","typeGuard":"null","tryCatchPattern":"try:\n    QuantizationConfigArgs(moe=shorthand)\nexcept ValueError as e:\n    if 'does not define a' in str(e):\n        spec = 'fp8_static_tensor_sym'  # explicit fallback for that field\n    else:\n        raise","preventionTips":["Apply shorthands at the top-level quantization field, not per-layer","Inspect _ONLINE_SHORTHANDS entries for None fields before reuse","Set unknown/uncovered fields to explicit QuantKey strings"],"tags":["quantization","config","validation"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}