{"record":{"id":"083a663d0b1701db","repo":"vllm-project/vllm","slug":"capture-torch-profiler-is-only-applicable-when-pro","errorCode":null,"errorMessage":"capture_torch_profiler is only applicable when profiler is set to 'torch'","messagePattern":"capture_torch_profiler is only applicable when profiler is set to 'torch'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/config/profiler.py","lineNumber":232,"sourceCode":"        if proton_profiler_dir:\n            if _is_uri_path(proton_profiler_dir):\n                raise ValueError(\"proton_profiler_dir must be a local directory\")\n            self.proton_profiler_dir = os.path.abspath(\n                os.path.expanduser(proton_profiler_dir)\n            )\n\n        if self.profiler == \"proton\":\n            output_format = self.proton_output_format\n            if output_format == \"chrome_trace\" and self.proton_data != \"trace\":\n                raise ValueError(\"chrome_trace output requires proton_data='trace'\")\n            if (\n                output_format in (\"hatchet\", \"hatchet_msgpack\")\n                and self.proton_data != \"tree\"\n            ):\n                raise ValueError(f\"{output_format} output requires proton_data='tree'\")\n\n        if self.capture_torch_profiler and self.profiler != \"torch\":\n            raise ValueError(\n                \"capture_torch_profiler is only applicable when profiler is \"\n                \"set to 'torch'\"\n            )\n\n        return self\n","sourceCodeStart":214,"sourceCodeEnd":238,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/config/profiler.py#L214-L238","documentation":"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.","triggerScenarios":"Passing --profiler-config capture_torch_profiler=true with profiler unset, or profiler='proton'/'cuda'.","commonSituations":"Debugging CUDA graph capture with a copied flag set from a torch-profiler config; enabling all profiling flags defensively.","solutions":["Set profiler='torch' (and torch_profiler_dir) when using capture_torch_profiler.","Or remove/disable capture_torch_profiler if not profiling with torch."],"exampleFix":"# before\nProfilerConfig(capture_torch_profiler=True)  # profiler is None\n\n# after\nProfilerConfig(profiler='torch', torch_profiler_dir='/tmp/tr', capture_torch_profiler=True)","handlingStrategy":"validation","validationCode":"def validate_capture_flag(capture: bool, profiler: str | None) -> None:\n    if capture and profiler != \"torch\":\n        raise SystemExit(\"capture_torch_profiler requires profiler='torch' (and torch_profiler_dir)\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat capture_torch_profiler as part of the torch profiler option group; enable the whole group together."],"tags":["profiling","cuda-graph","configuration"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}