unslothai/unsloth · error · HTTPException
Dropped dataset could not be read.
Error message
Dropped dataset could not be read.
What it means
HTTP 400 from native upload when copying the leased source file to storage raised an OSError — typically the source disappeared, became unreadable (permissions), or the destination write failed (disk full). The partial destination file is cleaned up in the finally block, so no orphan stored_path remains. The original OSError is chained (from exc) but the client only gets the generic message; the server traceback has the specifics.
Source
Thrown at studio/backend/hub/services/datasets/local.py:339
except NativePathLeaseError as exc:
raise HTTPException(status_code = 400, detail = str(exc)) from exc
filename, stored_path, max_bytes, max_label = _upload_destination(grant.canonical_path.name)
if grant.size_bytes is not None and grant.size_bytes > max_bytes:
raise _upload_too_large(max_label)
written = 0
upload_complete = False
try:
with open(grant.canonical_path, "rb") as source, open(stored_path, "wb") as target:
while chunk := source.read(LOCAL_UPLOAD_CHUNK_BYTES):
written += len(chunk)
if written > max_bytes:
raise _upload_too_large(max_label)
target.write(chunk)
upload_complete = True
except OSError as exc:
raise HTTPException(
status_code = 400,
detail = "Dropped dataset could not be read.",
) from exc
finally:
if not upload_complete:
with suppress(OSError):
stored_path.unlink(missing_ok = True)
if written == 0:
stored_path.unlink(missing_ok = True)
raise HTTPException(status_code = 400, detail = "Dropped dataset is empty")
return UploadDatasetResponse(filename = filename, stored_path = str(stored_path))
async def upload_dataset_response(
file: UploadFile | None, native_path_lease: str | None = None
) -> UploadDatasetResponse:View on GitHub (pinned to 203007d190)
Solutions
- Confirm the source file still exists at the same path and is readable, then re-import.
- Check destination disk space on the backend host (df -h on the upload dir).
- On Windows, close programs holding the file (Excel, sync clients) and retry.
- If it recurs, pull the chained OSError from server logs to identify read vs write failure.
Defensive patterns
Strategy: validation
Validate before calling
def source_readable(path: Path) -> bool:
try:
with path.open("rb") as f:
return f.read(1) == b"" or True # open+read proves readability
except OSError:
return False
def disk_has_space(dest_dir: Path, needed: int) -> bool:
return shutil.disk_usage(dest_dir).free > needed * 1.1 Try / catch
try:
upload_dataset(client, native_path_lease=lease)
except HTTPStatusError as e:
if e.response.status_code == 400 and "could not be read" in e.response.text:
reselect_file_and_retry() # source vanished/locked; destination was auto-cleaned
else:
raise Prevention
- Import immediately after picking; long gaps between pick and import are the top cause.
- Avoid importing from removable/network mounts that can disconnect.
- Monitor free space on the backend's upload volume.
When it happens
Trigger: The user moved/deleted/renamed the picked file between lease grant and import; source file locked by another process; destination disk full mid-copy; unreadable source due to OS permissions.
Common situations: Picking a file from a transient location (Downloads being cleaned, external drive unplugged, network share dropped); disk-full Studio volumes.
Related errors
- {str(exc)}
- Dropped dataset is empty
- Unsupported file type: {ext}. Allowed: {allowed}
- No dataset file was provided
- Empty upload payload
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/080ec44f9e876bbe.
Report an issue: GitHub.