{"record":{"id":"ab4ee3e9e9560d11","repo":"vllm-project/vllm","slug":"invalid-syntax-op-for-custom-op-must-be-all","errorCode":null,"errorMessage":"Invalid syntax '{op}' for custom op, must be 'all', 'none', '+op' or '-op' (where 'op' is the registered op name)","messagePattern":"Invalid syntax '(.+?)' for custom op, must be 'all', 'none', '\\+op' or '-op' \\(where 'op' is the registered op name\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/config/compilation.py","lineNumber":1000,"sourceCode":"            and not current_platform.is_cpu()\n        ):\n            # use horizontal fusion, which is useful for fusing qk-norm and\n            # qk-rope when query and key have different shapes.\n            self.inductor_compile_config[\"combo_kernels\"] = True\n            self.inductor_compile_config[\"benchmark_combo_kernel\"] = True\n\n        if self.use_inductor_graph_partition and not is_torch_equal_or_newer(\n            \"2.9.0.dev\"\n        ):\n            raise ValueError(\n                \"use_inductor_graph_partition is only \"\n                \"supported with torch>=2.9.0.dev. Set \"\n                \"use_inductor_graph_partition=False instead.\"\n            )\n\n        for op in self.custom_ops:\n            if op not in {\"all\", \"none\"} and (len(op) < 2 or op[0] not in {\"+\", \"-\"}):\n                raise ValueError(\n                    f\"Invalid syntax '{op}' for custom op, \"\n                    \"must be 'all', 'none', '+op' or '-op' \"\n                    \"(where 'op' is the registered op name)\"\n                )\n\n        base_modes = [op for op in self.custom_ops if op in {\"all\", \"none\"}]\n        if len(base_modes) > 1:\n            raise ValueError(\n                \"custom_ops can contain only one base mode: 'all' or 'none'\"\n            )\n\n        enabled_ops = {op[1:] for op in self.custom_ops if op.startswith(\"+\")}\n        disabled_ops = {op[1:] for op in self.custom_ops if op.startswith(\"-\")}\n        conflicting_ops = sorted(enabled_ops & disabled_ops)\n        if conflicting_ops:\n            raise ValueError(\n                \"custom_ops cannot both enable and disable the same operation(s): \"\n                f\"{', '.join(conflicting_ops)}. Remove either the '+' or '-' directive\"","sourceCodeStart":982,"sourceCodeEnd":1018,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/config/compilation.py#L982-L1018","documentation":"CompilationConfig.custom_ops selects which custom ops stay enabled under compilation, using a small grammar: exactly one base mode ('all' or 'none') plus optional '+op'/'-op' entries naming registered ops. Entries that are neither the base modes nor a >=2-character string starting with '+' or '-' raise ValueError.","triggerScenarios":"Passing CompilationConfig(custom_ops=['rms_norm']) (op name without sign prefix), ['*'], or ['ALL'] — anything not 'all', 'none', '+op' or '-op' — during config validation.","commonSituations":"Forgetting the +/- prefix when enabling/disabling a specific op; using uppercase 'All'; passing an empty string; listing the same op with both signs or multiple base modes.","solutions":["Use '+opname' to enable an op on top of the base mode, '-opname' to disable one, e.g. custom_ops=['none', '+rms_norm'].","Keep exactly one base mode ('all' or 'none') in the list.","Verify the op name matches a registered custom op."],"exampleFix":"# before\nCompilationConfig(custom_ops=['rms_norm', 'all'])\n# after\nCompilationConfig(custom_ops=['all', '-rms_norm'])","handlingStrategy":"type-guard","validationCode":"import re\nVALID = re.compile(r'^(all|none|[+-].+)$')\ndef valid_custom_ops(ops: list[str]) -> bool:\n    base = [o for o in ops if o in ('all', 'none')]\n    return len(base) <= 1 and all(VALID.match(o) for o in ops)","typeGuard":"def is_valid_custom_ops(value) -> bool:\n    if not isinstance(value, (list, tuple, set)):\n        return False\n    base = [o for o in value if o in ('all', 'none')]\n    return len(base) <= 1 and all(o in ('all', 'none') or (len(o) >= 2 and o[0] in '+-') for o in value)","tryCatchPattern":null,"preventionTips":["Always prefix individual ops with + or -","Include exactly one base mode ('all' or 'none')","Validate op names against torch.ops / vLLM custom op registry"],"tags":["configuration","custom-ops","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}