unslothai/unsloth · error · HTTPException

No images found in '{entry['repo']}'.

Error message

No images found in '{entry['repo']}'.

What it means

HTTP 502 from the import route: materialization completed without exceptions but wrote zero images (imported == 0) — every row was skipped (null image column values) or the source was empty. The empty staging dir is discarded; the existing dataset folder is untouched.

Source

Thrown at studio/backend/routes/training.py:4277

                    except OSError:
                        # Best effort: one unrestorable entry must not mask the original failure.
                        pass

            try:
                try:
                    if entry["loader"] == "imagefolder_jsonl":
                        imported = _materialize_imagefolder_jsonl(entry, staging, cap)
                    else:
                        imported = _materialize_hf_dataset(entry, staging, cap)
                except HTTPException:
                    raise
                except Exception as e:  # noqa: BLE001 -- surface a readable fetch/parse failure
                    raise HTTPException(
                        status_code = 502,
                        detail = f"Could not import '{entry['repo']}': {e}",
                    )
                if imported == 0:
                    raise HTTPException(
                        status_code = 502,
                        detail = f"No images found in '{entry['repo']}'.",
                    )
                # Promote the fully-materialized staging dir as a UNIT: a same-filesystem rename is atomic, so a hard process death
                # leaves either the old folder or the finished import. rmdir needs an empty target, so fold any pre-existing files (a .thumbs cache, an older metadata.jsonl) INTO staging first and keep one atomic promotion.
                try:
                    for p in sorted(folder.iterdir()):
                        # Same name in both: the imported file wins, as the previous per-file move did. Park the old one in the rescue dir so the folder can be emptied for the rename without destroying it.
                        dest = (rescue if (staging / p.name).exists() else staging) / p.name
                        shutil.move(str(p), str(dest))
                        folded.append((dest, p))
                    os.rmdir(folder)
                    os.replace(str(staging), str(folder))
                except (OSError, shutil.Error) as e:
                    # Every step here can fail (an unmovable entry, a folder that gained a file, a rename held by antivirus), and by then the folder's entries live only in the staging/rescue dirs the finally deletes.
                    restore_folded()
                    raise HTTPException(
                        status_code = 409,

View on GitHub (pinned to 203007d190)

Solutions

  1. Pick a different example dataset or retry later (upstream may be mid-migration).
  2. Verify the repo manually: load a few rows and check the image column is non-null.
  3. If curating locally, point the example at a known-good revision (revision= pin).

Example fix

from itertools import islice
from datasets import load_dataset
rows = list(islice(load_dataset('user/repo', streaming=True), 5))
nonnull = sum(r['image'] is not None for r in rows)
print(nonnull, 'of', len(rows), 'rows have images')
Defensive patterns

Strategy: validation

Validate before calling

from itertools import islice
from datasets import load_dataset

def example_has_images(repo: str) -> bool:
    rows = list(islice(load_dataset(repo, streaming=True), 5))
    return bool(rows) and any(
        any(isinstance(v, dict) and v.get('bytes', v.get('path')) for v in r.values())
        for r in rows
    )

Type guard

def is_empty_import(exc: HTTPException) -> bool:
    return exc.status_code == 502 and 'No images found' in str(exc.detail)

Try / catch

try:
    await api.importExample(ex.id)
except HTTPStatusError as e:
    if e.response.status_code == 502 and 'No images found' in e.response.text:
        pick_another_example()  # all-null upstream; retrying same id will fail again
    else:
        raise

Prevention

When it happens

Trigger: Importing an example whose upstream rows all have null in the image column, or whose split/config resolves to an empty set. E.g. a repo revision where all image cells are null, or cap=0 misconfiguration.

Common situations: Upstream datasets with sparse image columns that became fully null after a revision; split names changing so the selected split is empty; curated entry pointing at a deprecated revision.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/e400a34e53c2eda9. Report an issue: GitHub.