sgl-project/sglang · error · ValueError
{label}: no .pt files found in {directory} or any of its sub
Error message
{label}: no .pt files found in {directory} or any of its subdirectories. What it means
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.
Source
Thrown at python/sglang/srt/debug_utils/comparator/utils.py:45
or when no .pt data is found at all.
"""
if any(directory.glob("*.pt")):
return directory
candidates: list[Path] = [
sub for sub in directory.iterdir() if sub.is_dir() and any(sub.glob("*.pt"))
]
if len(candidates) >= 2:
names: str = ", ".join(sorted(c.name for c in candidates))
raise ValueError(
f"{label}: directory {directory} has no .pt files at top level "
f"and multiple subdirectories contain data ({names}). "
f"Please specify the exact subdirectory."
)
if len(candidates) == 0:
raise ValueError(
f"{label}: no .pt files found in {directory} or any of its subdirectories."
)
resolved: Path = candidates[0]
from sglang.srt.debug_utils.comparator.log_sink import log_sink
from sglang.srt.debug_utils.comparator.output_types import InfoLog
log_sink.add(
InfoLog(
category="auto_descend",
message=f"auto-descend {label}: {directory} -> {resolved}",
)
)
return resolved
class _StrictBase(BaseModel):View on GitHub (pinned to 0132848349)
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
Example fix
# before
auto_descend_dir(Path('runs'), 'dump') # runs/ has no .pt anywhere nearby
# after
auto_descend_dir(Path('runs/exp7/layer_dumps'), 'dump') # level with .pt files Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
def has_pt_files(d: Path) -> bool:
return bool(list(d.glob('*.pt'))) or any(list(p.glob('*.pt')) for p in d.iterdir() if p.is_dir()) Try / catch
try:
resolved = auto_descend_dir(directory, label)
except ValueError as e:
print(e); sys.exit(2) Prevention
- 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)
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- {label}: directory {directory} has no .pt files at top level
- Prompt text file not found: {path}
- Mesh not found
- Image path not found: {batch.image_path}
- LoRA with name {lora_name} does not exist. Loaded LoRAs: {se
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1708a00e5a95ee29.
Report an issue: GitHub.