{"record":{"id":"7de969e3b7480cc9","repo":"vllm-project/vllm","slug":"invalid-compilation-mode-value-valid-modes-are","errorCode":null,"errorMessage":"Invalid compilation mode: {value}. Valid modes are: {', '.join(CompilationMode.__members__.keys())}","messagePattern":"Invalid compilation mode: (.+?)\\. Valid modes are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/config/compilation.py","lineNumber":856,"sourceCode":"\n        return str(config)\n\n    __str__ = __repr__\n\n    @field_validator(\"mode\", mode=\"before\")\n    @classmethod\n    def validate_mode_before(cls, value: Any) -> Any:\n        \"\"\"\n        Enable parsing the `mode` field from string mode names.\n        Accepts both integers (0-3) and string names, like NONE, STOCK_TORCH_COMPILE,\n        DYNAMO_TRACE_ONCE, VLLM_COMPILE.\n        \"\"\"\n        if isinstance(value, str):\n            # Convert string mode name to integer value\n            mode_name = value.upper()\n\n            if mode_name not in CompilationMode.__members__:\n                raise ValueError(\n                    f\"Invalid compilation mode: {value}. \"\n                    f\"Valid modes are: {', '.join(CompilationMode.__members__.keys())}\"\n                )\n\n            return CompilationMode[mode_name]\n        return value\n\n    @field_validator(\"cudagraph_mode\", mode=\"before\")\n    @classmethod\n    def validate_cudagraph_mode_before(cls, value: Any) -> Any:\n        \"\"\"Enable parsing of the `cudagraph_mode` enum type from string.\"\"\"\n        if isinstance(value, str):\n            return CUDAGraphMode[value.upper()]\n        return value\n\n    @field_validator(\"pass_config\", mode=\"before\")\n    @classmethod\n    def validate_pass_config_before(cls, value: Any) -> Any:","sourceCodeStart":838,"sourceCodeEnd":874,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/config/compilation.py#L838-L874","documentation":"CompilationConfig's mode field accepts either the integer enum value or a string name; strings are upper-cased and looked up in CompilationMode.__members__. A string that matches no member (NONE, STOCK_TORCH_COMPILE, DYNAMO_TRACE_ONCE, VLLM_COMPILE) raises ValueError listing valid names.","triggerScenarios":"Passing compilation_config=CompilationConfig(mode='PIECEWISE') or any misspelled/outdated mode name from the CLI, env, or Python config.","commonSituations":"Configs ported from older vLLM where modes had different names (e.g. 'piecewise'); typos like 'vllm' or 'torch_compile'; lower-case names are fine since they are upper-cased, but wrong words are not.","solutions":["Use a valid mode name: 'NONE', 'STOCK_TORCH_COMPILE', 'DYNAMO_TRACE_ONCE', or 'VLLM_COMPILE'.","Or pass the integer enum value from vllm.config.compilation.CompilationMode.","For quick control, use the -O level flags (e.g. -O3 maps to VLLM_COMPILE) instead of raw mode strings."],"exampleFix":"# before\nCompilationConfig(mode='PIECEWISE')\n# after\nCompilationConfig(mode='VLLM_COMPILE')","handlingStrategy":"type-guard","validationCode":"from vllm.config.compilation import CompilationMode\n\ndef valid_mode(value: str) -> bool:\n    return value.upper() in CompilationMode.__members__","typeGuard":"from vllm.config.compilation import CompilationMode\n\ndef is_valid_compilation_mode(value) -> bool:\n    if isinstance(value, CompilationMode):\n        return True\n    return isinstance(value, str) and value.upper() in CompilationMode.__members__","tryCatchPattern":null,"preventionTips":["Reference CompilationMode members instead of raw strings","Wrap user-provided mode strings in a validator before config construction","Use -O level flags for common cases"],"tags":["configuration","compilation-mode","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}