vllm-project/vllm · error · ValueError
capture_torch_profiler is only applicable when profiler is s
Error message
capture_torch_profiler is only applicable when profiler is set to 'torch'
What it means
ProfilerConfig rejects capture_torch_profiler=True when profiler is not 'torch'. The flag enables a torch profiler specifically during CUDA graph capture on rank 0 and writes traces into a capture_traces subdirectory of torch_profiler_dir, so it is meaningless without the torch profiler selected.
Source
Thrown at vllm/config/profiler.py:232
if proton_profiler_dir:
if _is_uri_path(proton_profiler_dir):
raise ValueError("proton_profiler_dir must be a local directory")
self.proton_profiler_dir = os.path.abspath(
os.path.expanduser(proton_profiler_dir)
)
if self.profiler == "proton":
output_format = self.proton_output_format
if output_format == "chrome_trace" and self.proton_data != "trace":
raise ValueError("chrome_trace output requires proton_data='trace'")
if (
output_format in ("hatchet", "hatchet_msgpack")
and self.proton_data != "tree"
):
raise ValueError(f"{output_format} output requires proton_data='tree'")
if self.capture_torch_profiler and self.profiler != "torch":
raise ValueError(
"capture_torch_profiler is only applicable when profiler is "
"set to 'torch'"
)
return self
View on GitHub (pinned to c794754062)
Solutions
- Set profiler='torch' (and torch_profiler_dir) when using capture_torch_profiler.
- Or remove/disable capture_torch_profiler if not profiling with torch.
Example fix
# before ProfilerConfig(capture_torch_profiler=True) # profiler is None # after ProfilerConfig(profiler='torch', torch_profiler_dir='/tmp/tr', capture_torch_profiler=True)
Defensive patterns
Strategy: validation
Validate before calling
def validate_capture_flag(capture: bool, profiler: str | None) -> None:
if capture and profiler != "torch":
raise SystemExit("capture_torch_profiler requires profiler='torch' (and torch_profiler_dir)") Prevention
- Treat capture_torch_profiler as part of the torch profiler option group; enable the whole group together.
When it happens
Trigger: Passing --profiler-config capture_torch_profiler=true with profiler unset, or profiler='proton'/'cuda'.
Common situations: Debugging CUDA graph capture with a copied flag set from a torch-profiler config; enabling all profiling flags defensively.
Related errors
- Unable to use nsight profiling unless workers run with Ray.
- torch_profiler_dir is only applicable when profiler is set t
- torch_profiler_dir must be set when profiler is 'torch'
- {options} only applicable when profiler is set to 'proton'
- proton_profiler_dir must be set when profiler is 'proton'
AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14).
Data as JSON: /api/errors/083a663d0b1701db.
Report an issue: GitHub.