vllm-project/vllm · warning · ValueError
Unsupported file type: {file_path}
Error message
Unsupported file type: {file_path} What it means
The SPDX pre-commit hook only knows comment styles for .py, .rs, and .proto (FILE_STYLES map). When the hook is handed any other suffix, file_style() raises ValueError('Unsupported file type: ...'). This is a lint-time error in the hook itself, not a license problem in your file.
Source
Thrown at tools/pre_commit/check_spdx_header.py:43
MISSING_BOTH = "missing_both" # Completely missing
LICENSE_TEXT = "SPDX-License-Identifier: Apache-2.0"
COPYRIGHT_TEXT = "SPDX-FileCopyrightText: Copyright contributors to the vLLM project"
FILE_STYLES = {
".py": HeaderStyle("#", preserve_shebang=True),
".rs": HeaderStyle("//"),
".proto": HeaderStyle("//"),
}
def file_style(file_path):
"""Return the declared header style for a file."""
suffix = Path(file_path).suffix
try:
return FILE_STYLES[suffix]
except KeyError:
raise ValueError(f"Unsupported file type: {file_path}") from None
def spdx_header(style):
"""Return the SPDX header for a file style."""
license_line = f"{style.comment_prefix} {LICENSE_TEXT}"
copyright_line = f"{style.comment_prefix} {COPYRIGHT_TEXT}"
return license_line, copyright_line
def header_insertion_index(style, lines):
"""Return the line index where a missing header should be inserted."""
if style.preserve_shebang and lines and lines[0].startswith("#!"):
return 1
return 0
def check_spdx_header_status(file_path):
"""Check SPDX header status of the file"""View on GitHub (pinned to c794754062)
Solutions
- Narrow the hook configuration in .pre-commit-config.yaml so check_spdx_header only runs on file types it supports (files: '\.(py|rs|proto)$').
- If the new extension should carry SPDX headers, add a HeaderStyle entry to FILE_STYLES in tools/pre_commit/check_spdx_header.py (e.g. '.cpp': HeaderStyle('//')).
- Exclude the specific file via the hook's `exclude:` pattern if it must not be checked.
Example fix
# before (.pre-commit-config.yaml) - id: check-spdx-header files: vllm/.* # after - id: check-spdx-header files: \.(py|rs|proto)$
Defensive patterns
Strategy: type-guard
Validate before calling
from pathlib import Path
SUPPORTED = {".py", ".rs", ".proto"}
files = [f for f in staged_files if Path(f).suffix in SUPPORTED] # only pass these to the hook Type guard
from pathlib import Path
def is_spdx_supported(file_path: str) -> bool:
"""True when check_spdx_header.py can process this file."""
return Path(file_path).suffix in {".py", ".rs", ".proto"} Prevention
- Keep the pre-commit hook's file filter in sync with FILE_STYLES when adding extensions.
- Add a HeaderStyle entry for any new extension before committing files of that type.
- Run `pre-commit run --all-files` locally before widening any hook's file patterns.
When it happens
Trigger: The pre-commit hook's files filter matching a file with an unsupported extension (e.g. .cpp, .cu, .js, .md) — usually after the hook's file pattern was broadened or such a file was added under a directory the pattern covers.
Common situations: Contributing a new non-Python source file that the SPDX hook glob accidentally matches; editing .pre-commit-config.yaml to widen the hook's `files:`/`types:` filter.
Related errors
- ❌ line({node.lineno}): {message}
- Could not determine Python executable. Please provide it man
- CUDA is required for this proof.
- Failed to find the NIXL wheel after building it.
- Failed to find the repaired NIXL wheel.
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/cc067169b3ff75ba.
Report an issue: GitHub.