{"record":{"id":"5c9ba541e5b541d0","repo":"unslothai/unsloth","slug":"all-total-samples-failed-during-vlm-conversion","errorCode":null,"errorMessage":"All {total} samples failed during VLM conversion — no usable images found. This dataset may contain only image URLs that are no longer accessible.","messagePattern":"All (.+?) samples failed during VLM conversion — no usable images found\\. This dataset may contain only image URLs that are no longer accessible\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/datasets/format_conversion.py","lineNumber":692,"sourceCode":"\n    if len(converted_list) == 0:\n        issues = [\n            f\"All {total} samples failed during VLM conversion — no usable images found\",\n            f\"Image column '{image_column}' may contain URLs that are no longer accessible, \"\n            \"or local file paths that don't exist\",\n        ]\n        friendly = None\n        try:\n            from .llm_assist import llm_generate_dataset_warning\n            friendly = llm_generate_dataset_warning(\n                issues,\n                dataset_name = dataset_name,\n                modality = \"vision\",\n                column_names = [image_column, text_column],\n            )\n        except Exception:\n            pass\n        raise ValueError(\n            friendly\n            or (\n                f\"All {total} samples failed during VLM conversion — no usable images found. \"\n                \"This dataset may contain only image URLs that are no longer accessible.\"\n            )\n        )\n\n    logger.info(f\"✅ Converted {len(converted_list)}/{total} samples\")\n    _notify(f\"Converted {len(converted_list):,}/{total:,} images successfully\")\n\n    # Return list, NOT a Dataset\n    return converted_list\n\n\ndef convert_sharegpt_with_images_to_vlm_format(\n    dataset,\n    image_column = \"image\",\n    messages_column = \"conversations\",","sourceCodeStart":674,"sourceCodeEnd":710,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/datasets/format_conversion.py#L674-L710","documentation":"Raised when VLM conversion finishes with an empty converted_list: every single sample failed to produce a usable image, so there is nothing to train on. The message is enriched with an LLM-generated hint (llm_generate_dataset_warning) when available, otherwise the default text is raised. It explicitly points at unreachable URLs or nonexistent local paths in the image column.","triggerScenarios":"Converting a dataset where 100% of samples fail image resolution: all URLs 404, all local file paths missing, or the image column actually holding non-image data (e.g. captions) so Image.open fails on every row.","commonSituations":"Dataset moved/renamed so relative local image paths no longer resolve; column misconfiguration (user selected the wrong column as image_column); dataset loaded from a machine where images were on an unmounted drive; all URLs from a dead host.","solutions":["Verify the image column actually contains images: inspect a few values (URL or path) and open one manually.","If local paths, check they exist from the backend's working directory and remount/copy the image folder.","If URLs, curl a few to confirm reachability and auth requirements (HF token, cookies).","Re-run conversion with the correct image_column / text_column mapping.","Fall back to a dataset with embedded image bytes."],"exampleFix":"# before\nconverted = convert_vlm(ds, image_column=\"caption\")  # wrong column -> all fail\n\n# after\nconverted = convert_vlm(ds, image_column=\"image_url\", text_column=\"caption\")","handlingStrategy":"validation","validationCode":"def dataset_has_resolvable_images(ds, image_column, n=5):\n    \"\"\"Check the first n samples resolve to bytes/path/URL before converting.\"\"\"\n    for sample in ds.select(range(min(n, len(ds)))):\n        v = sample[image_column]\n        ok = (\n            isinstance(v, str)\n            or (isinstance(v, dict) and (\"bytes\" in v or \"path\" in v))\n        )\n        if not ok:\n            return False\n    return len(ds) > 0","typeGuard":"def is_resolvable_image(value) -> bool:\n    if isinstance(value, str) and value:\n        return True\n    if isinstance(value, dict):\n        return bool(value.get(\"bytes\") or value.get(\"path\"))\n    return False","tryCatchPattern":"try:\n    converted = convert_vlm(ds, image_column=col)\nexcept ValueError as e:\n    if \"no usable images found\" in str(e):\n        raise SystemExit(f\"Image column '{col}' unusable; inspect {col} values\") from e\n    raise","preventionTips":["Always spot-check ds[image_column][:5] (type + one manual open) before conversion.","Validate that image paths exist relative to the backend's cwd, not your shell's.","Confirm column names via dataset.features before mapping columns.","Prefer datasets with embedded image bytes for reproducible training runs."],"tags":["dataset","vlm","image-resolution","column-config"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}