vllm-project/vllm · error · ValueError
Invalid syntax '{op}' for custom op, must be 'all', 'none',
Error message
Invalid syntax '{op}' for custom op, must be 'all', 'none', '+op' or '-op' (where 'op' is the registered op name) What it means
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.
Source
Thrown at vllm/config/compilation.py:1000
and not current_platform.is_cpu()
):
# use horizontal fusion, which is useful for fusing qk-norm and
# qk-rope when query and key have different shapes.
self.inductor_compile_config["combo_kernels"] = True
self.inductor_compile_config["benchmark_combo_kernel"] = True
if self.use_inductor_graph_partition and not is_torch_equal_or_newer(
"2.9.0.dev"
):
raise ValueError(
"use_inductor_graph_partition is only "
"supported with torch>=2.9.0.dev. Set "
"use_inductor_graph_partition=False instead."
)
for op in self.custom_ops:
if op not in {"all", "none"} and (len(op) < 2 or op[0] not in {"+", "-"}):
raise ValueError(
f"Invalid syntax '{op}' for custom op, "
"must be 'all', 'none', '+op' or '-op' "
"(where 'op' is the registered op name)"
)
base_modes = [op for op in self.custom_ops if op in {"all", "none"}]
if len(base_modes) > 1:
raise ValueError(
"custom_ops can contain only one base mode: 'all' or 'none'"
)
enabled_ops = {op[1:] for op in self.custom_ops if op.startswith("+")}
disabled_ops = {op[1:] for op in self.custom_ops if op.startswith("-")}
conflicting_ops = sorted(enabled_ops & disabled_ops)
if conflicting_ops:
raise ValueError(
"custom_ops cannot both enable and disable the same operation(s): "
f"{', '.join(conflicting_ops)}. Remove either the '+' or '-' directive"View on GitHub (pinned to c794754062)
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.
Example fix
# before CompilationConfig(custom_ops=['rms_norm', 'all']) # after CompilationConfig(custom_ops=['all', '-rms_norm'])
Defensive patterns
Strategy: type-guard
Validate before calling
import re
VALID = re.compile(r'^(all|none|[+-].+)$')
def valid_custom_ops(ops: list[str]) -> bool:
base = [o for o in ops if o in ('all', 'none')]
return len(base) <= 1 and all(VALID.match(o) for o in ops) Type guard
def is_valid_custom_ops(value) -> bool:
if not isinstance(value, (list, tuple, set)):
return False
base = [o for o in value if o in ('all', 'none')]
return len(base) <= 1 and all(o in ('all', 'none') or (len(o) >= 2 and o[0] in '+-') for o in value) Prevention
- Always prefix individual ops with + or -
- Include exactly one base mode ('all' or 'none')
- Validate op names against torch.ops / vLLM custom op registry
When it happens
Trigger: Passing CompilationConfig(custom_ops=['rms_norm']) (op name without sign prefix), ['*'], or ['ALL'] — anything not 'all', 'none', '+op' or '-op' — during config validation.
Common situations: 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.
Related errors
- invalid --allowed-methods value {method:?}: {e}
- invalid --allowed-headers value {header:?}: {e}
- --ssl-certfile is required to enable TLS; --ssl-keyfile/--ss
- --ssl-cert-reqs must be 0 (none), 1 (optional), or 2 (requir
- --ssl-ca-certs is required when --ssl-cert-reqs is {} (clien
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/ab4ee3e9e9560d11.
Report an issue: GitHub.