vllm-project/vllm · warning · ValueError
❌ line({node.lineno}): {message}
Error message
❌ line({node.lineno}): {message} What it means
tools/pre_commit/validate_config.py walks the AST of files under vllm/ and tests/ that use the @config decorator and enforces rules on config classes (e.g. disallowed statements in decorated classes). fail() raises ValueError with the offending line number; main() prints it and exits 1, failing the pre-commit run.
Source
Thrown at tools/pre_commit/validate_config.py:150
def validate_file(file_path: str):
try:
print(f"Validating {file_path} config dataclasses ", end="")
with open(file_path, encoding="utf-8") as f:
source = f.read()
tree = ast.parse(source, filename=file_path)
validate_ast(tree)
except ValueError as e:
print(e)
raise SystemExit(1) from e
else:
print("✅")
def fail(message: str, node: ast.stmt):
raise ValueError(f"❌ line({node.lineno}): {message}")
def main():
for filename in sys.argv[1:]:
# Only run for Python files in vllm/ or tests/
if not re.match(r"^(vllm|tests)/.*\.py$", filename):
continue
# Only run if the file contains @config
with open(filename, encoding="utf-8") as f:
if "@config" in f.read():
validate_file(filename)
if __name__ == "__main__":
main()
View on GitHub (pinned to c794754062)
Solutions
- Open the file at the reported line number and fix the flagged construct (move logic out of the @config class body, keep only field/schema definitions).
- Run `pre-commit run validate-config --files <yourfile>` locally to iterate quickly before pushing.
- Mirror the style of existing @config classes in vllm/config.py (declarative fields only).
Example fix
# before (vllm/my_config.py)
@config
class MyConfig:
total = a + b # ❌ line(8): dynamic statement in @config class
# after
@config
class MyConfig:
a: int = 1
b: int = 2 Defensive patterns
Strategy: try-catch
Validate before calling
# Fast local gate before committing @config changes
import subprocess, sys
rc = subprocess.run(["python", "tools/pre_commit/validate_config.py", "vllm/config.py"]).returncode
if rc != 0:
raise SystemExit("Fix @config violations before committing") Try / catch
try:
validate_file(path) # tools/pre_commit/validate_config.py
except ValueError as e:
print(e) # message carries the offending line number
raise SystemExit(1) Prevention
- Run the validate_config pre-commit hook locally before every push touching @config classes.
- Keep @config class bodies declarative; put logic elsewhere.
- Copy the structure of existing config classes in vllm/config.py.
When it happens
Trigger: Adding or editing a class decorated with @config in vllm/ or tests/ in a way the validator forbids — e.g. statements inside the config class body that the AST validator rejects — then running pre-commit (validate_config hook) on that file.
Common situations: Contributing a new config dataclass to vllm/config.py and writing logic (assignments, imports, function defs) the validator prohibits; refactoring an existing @config class so it trips a rule that previously passed.
Related errors
- Unsupported file type: {file_path}
- {kind} parsing is not available for model `{model_id}`
- {kind} parsing is disabled by frontend configuration
- cannot use in-process coordinator with bootstrapped transpor
- Could not determine Python executable. Please provide it man
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/e4bc54068b9bbfba.
Report an issue: GitHub.