{"record":{"id":"e5425348c26a021a","repo":"sgl-project/sglang","slug":"model-directory-model-path-does-not-contain-mode","errorCode":null,"errorMessage":"Model directory {model_path} does not contain model_index.json. Only HuggingFace diffusers format is supported.","messagePattern":"Model directory (.+?) does not contain model_index\\.json\\. Only HuggingFace diffusers format is supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py","lineNumber":700,"sourceCode":"        )\n    return target\n\n\ndef verify_model_config_and_directory(model_path: str) -> dict[str, Any]:\n    \"\"\"\n    Verify that the model directory contains a valid diffusers configuration.\n\n    Args:\n        model_path: Path to the model directory\n\n    Returns:\n        The loaded model configuration as a dictionary\n    \"\"\"\n\n    # Check for model_index.json which is required for diffusers models\n    config_path = os.path.join(model_path, \"model_index.json\")\n    if not os.path.exists(config_path):\n        raise ValueError(\n            f\"Model directory {model_path} does not contain model_index.json. \"\n            \"Only HuggingFace diffusers format is supported.\"\n        )\n\n    # Load the config\n    with open(config_path) as f:\n        config = json.load(f)\n\n    # Verify diffusers version exists\n    if \"_diffusers_version\" not in config:\n        raise ValueError(\"model_index.json does not contain _diffusers_version\")\n\n    logger.info(\"Diffusers version: %s\", config[\"_diffusers_version\"])\n\n    component_keys = [\n        key\n        for key, value in config.items()\n        if isinstance(value, (list, tuple))","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py#L682-L718","documentation":"verify_model_config_and_directory requires a diffusers-format model: the directory must contain model_index.json. If missing (e.g. you pointed at a single-file checkpoint or a non-diffusers repo), ValueError.","triggerScenarios":"Calling from_pretrained / _load_config / maybe_download_model_index with a model_path that has no model_index.json — e.g. a raw transformer folder, a ComfyUI/single-file .safetensors checkpoint, or a GGUF repo.","commonSituations":"Using a checkpoint that is not the '-Diffusers' variant of a model; downloading only the transformer component; passing a config-only path.","solutions":["Use the diffusers-format repo (often suffixed '-Diffusers') instead of the original single-file checkpoint","If it's a legit diffusers model, re-download fully — model_index.json may have been lost","For single transformer components, use the component-specific loader rather than the pipeline loader"],"exampleFix":"# before\n--model stabilityai/stable-diffusion-3-medium  # non-diffusers layout\n# after\n--model stabilityai/stable-diffusion-3-medium-diffusers","handlingStrategy":"validation","validationCode":"import os\nassert os.path.isfile(os.path.join(model_path, 'model_index.json')), 'not a diffusers-format model'","typeGuard":null,"tryCatchPattern":"try:\n    from_pretrained(path)\nexcept ValueError as e:\n    if 'model_index.json' in str(e):\n        from_pretrained(diffusers_variant_repo)","preventionTips":["Standardize on '-Diffusers' repo variants","Validate directory layout at model registration time"],"tags":["model-format","diffusers","validation"],"backgroundTag":"unsupported-model-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}