{"record":{"id":"1708a00e5a95ee29","repo":"sgl-project/sglang","slug":"label-no-pt-files-found-in-directory-or-any","errorCode":null,"errorMessage":"{label}: no .pt files found in {directory} or any of its subdirectories.","messagePattern":"(.+?): no \\.pt files found in (.+?) or any of its subdirectories\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/debug_utils/comparator/utils.py","lineNumber":45,"sourceCode":"    or when no .pt data is found at all.\n    \"\"\"\n    if any(directory.glob(\"*.pt\")):\n        return directory\n\n    candidates: list[Path] = [\n        sub for sub in directory.iterdir() if sub.is_dir() and any(sub.glob(\"*.pt\"))\n    ]\n\n    if len(candidates) >= 2:\n        names: str = \", \".join(sorted(c.name for c in candidates))\n        raise ValueError(\n            f\"{label}: directory {directory} has no .pt files at top level \"\n            f\"and multiple subdirectories contain data ({names}). \"\n            f\"Please specify the exact subdirectory.\"\n        )\n\n    if len(candidates) == 0:\n        raise ValueError(\n            f\"{label}: no .pt files found in {directory} or any of its subdirectories.\"\n        )\n\n    resolved: Path = candidates[0]\n\n    from sglang.srt.debug_utils.comparator.log_sink import log_sink\n    from sglang.srt.debug_utils.comparator.output_types import InfoLog\n\n    log_sink.add(\n        InfoLog(\n            category=\"auto_descend\",\n            message=f\"auto-descend {label}: {directory} -> {resolved}\",\n        )\n    )\n    return resolved\n\n\nclass _StrictBase(BaseModel):","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/debug_utils/comparator/utils.py#L27-L63","documentation":"auto_descend_dir raises this when neither the given directory nor any of its immediate subdirectories contain .pt files — i.e. the search for tensor dumps found nothing at all.","triggerScenarios":"Calling run()/auto_descend_dir on an empty directory, one containing only unrelated files, or a path whose .pt files live two or more levels deep (descent is only one level).","commonSituations":"Wrong --dir path (typo, relative-path confusion), dumps not yet written/flushed, files named *.pth/*.bin instead of *.pt, or nested layout deeper than one level.","solutions":["Verify the path with ls <dir>/*.pt","If files are deeper, point --dir at the level that directly contains the .pt files","Confirm dumps were actually saved (check dumper output/logs) and use the .pt extension"],"exampleFix":"# before\nauto_descend_dir(Path('runs'), 'dump')   # runs/ has no .pt anywhere nearby\n# after\nauto_descend_dir(Path('runs/exp7/layer_dumps'), 'dump')  # level with .pt files","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef has_pt_files(d: Path) -> bool:\n    return bool(list(d.glob('*.pt'))) or any(list(p.glob('*.pt')) for p in d.iterdir() if p.is_dir())","typeGuard":null,"tryCatchPattern":"try:\n    resolved = auto_descend_dir(directory, label)\nexcept ValueError as e:\n    print(e); sys.exit(2)","preventionTips":["Confirm dumps are flushed and use the .pt extension","Point --dir at the directory that directly holds the .pt files (descent is one level only)"],"tags":["filesystem","missing-files","dump","not-found"],"backgroundTag":"input-files-not-found","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}