{"record":{"id":"765a490006d9488c","repo":"sgl-project/sglang","slug":"no-trace-files-found-for-profile-id-self-profile","errorCode":null,"errorMessage":"No trace files found for profile_id: {self.profile_id}","messagePattern":"No trace files found for profile_id: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/profile_merger.py","lineNumber":50,"sourceCode":"            \"pp_rank\": 10_000,\n            \"tp_rank\": 100,\n        }\n\n        # PID threshold for sort_index updates (only update for system PIDs < 1000)\n        self.pid_sort_index_threshold = 1000\n\n    def merge_chrome_traces(self) -> str:\n        \"\"\"Merge Chrome traces from all ranks into a single trace.\n\n        Returns:\n            Path to merged trace file.\n\n        Raises:\n            ValueError: If no trace files found.\n        \"\"\"\n        trace_files = self._discover_trace_files()\n        if not trace_files:\n            raise ValueError(f\"No trace files found for profile_id: {self.profile_id}\")\n\n        logger.info(f\"Found {len(trace_files)} trace files to merge\")\n\n        merged_trace = {\"traceEvents\": []}\n        all_device_properties = []\n\n        for trace_file in sorted(trace_files, key=self._get_rank_sort_key):\n            rank_info = self._extract_rank_info(trace_file)\n            logger.info(f\"Processing {trace_file} with rank info: {rank_info}\")\n\n            output = self._handle_file(trace_file, rank_info)\n\n            merged_trace[\"traceEvents\"].extend(output[\"traceEvents\"])\n\n            if \"deviceProperties\" in output:\n                all_device_properties.extend(output[\"deviceProperties\"])\n                del output[\"deviceProperties\"]\n","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/profile_merger.py#L32-L68","documentation":"ProfileTraceMerger.merge_chrome_traces discovers trace files by profile_id under the output directory and found none, so it cannot merge. Raised before any merging work starts.","triggerScenarios":"Calling merge_chrome_traces with a profile_id whose directory is empty/missing, traces written to a different output_dir, or profiling never actually produced a trace (failed start, wrong worker).","commonSituations":"Merging after a profiler run where workers crashed, output_dir misconfigured between start and merge, or profile_id typo'd/mismatched with the folder name.","solutions":["Verify the trace directory exists and contains *.json/.gz trace files for the profile_id","Ensure output_dir and profile_id passed to the merger match those used when starting profiling","Confirm the profiling session actually started (check logs for 'Profiling starts') and workers flushed traces before merging"],"exampleFix":"# before\nmerger = ProfileTraceMerger(output_dir='/tmp/wrong', profile_id='p1').merge_chrome_traces()\n# after\nmerger = ProfileTraceMerger(output_dir=real_output_dir, profile_id='p1').merge_chrome_traces()","handlingStrategy":"validation","validationCode":"from pathlib import Path\ntraces = list(Path(output_dir).rglob(f'*{profile_id}*trace*'))\nassert traces, f'no traces for {profile_id}, not starting merge'","typeGuard":"null","tryCatchPattern":"try:\n    merger.merge_chrome_traces()\nexcept ValueError as e:\n    if 'No trace files' in str(e):\n        logger.error('profiling produced no output; rerun with wider window')","preventionTips":["Confirm trace files exist on disk before merging","Reuse the exact output_dir/profile_id from profiling start","Check worker logs that traces flushed before triggering merge"],"tags":["profiling","trace-merge","chrome-trace","sglang"],"backgroundTag":"missing-profile-output","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}