{"record":{"id":"76c8a114a1efbd19","repo":"sgl-project/sglang","slug":"model-index-json-for-model-name-or-path-does-not","errorCode":null,"errorMessage":"model_index.json for {model_name_or_path} does not contain _class_name field","messagePattern":"model_index\\.json for (.+?) does not contain _class_name field","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py","lineNumber":823,"sourceCode":"            # Not a pipeline, maybe a single model.\n            config_path = os.path.join(model_name_or_path, \"config.json\")\n            if os.path.exists(config_path):\n                with open(config_path) as f:\n                    config = json.load(f)\n                return config\n            raise\n\n    # For remote models, resolve model_index.json (Hub-first, cache fallback).\n    try:\n        model_index_path = _resolve_remote_repo_model_index_path(model_name_or_path)\n\n        # Load the model_index.json\n        with open(model_index_path) as f:\n            config: dict[str, Any] = json.load(f)\n\n        # Verify it has the required fields\n        if \"_class_name\" not in config:\n            raise ValueError(\n                f\"model_index.json for {model_name_or_path} does not contain _class_name field\"\n            )\n\n        if \"_diffusers_version\" not in config:\n            raise ValueError(\n                f\"model_index.json for {model_name_or_path} does not contain _diffusers_version field\"\n            )\n\n        # Add the pipeline name for downstream use\n        config[\"pipeline_name\"] = config[\"_class_name\"]\n\n        logger.debug(\n            \"Resolved model_index.json for %s, pipeline: %s\",\n            model_name_or_path,\n            config[\"_class_name\"],\n        )\n        return config\n    except EntryNotFoundError:","sourceCodeStart":805,"sourceCodeEnd":841,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/utils/hf_diffusers_utils.py#L805-L841","documentation":"maybe_download_model_index validates the downloaded model_index.json requires a _class_name field (the pipeline class, e.g. FluxPipeline). Missing field means the JSON is not a valid diffusers pipeline index.","triggerScenarios":"Calling _get_config_info / get_model_info / _has_pe_in_model_index on a repo whose model_index.json lacks _class_name — hand-written index, stripped metadata, or a non-pipeline JSON that happens to be named model_index.json.","commonSituations":"Custom-merged model repos; metadata-stripping proxies/mirrors; misconfigured cache serving the wrong file.","solutions":["Add \"_class_name\": \"<PipelineName>\" to the repo's model_index.json","Use the official diffusers repo revision for the model"],"exampleFix":"// model_index.json before: {}\n// after: {\"_class_name\":\"FluxPipeline\",\"_diffusers_version\":\"0.32.0\"}","handlingStrategy":"validation","validationCode":"cfg = json.load(open(model_index_path))\nassert '_class_name' in cfg","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use official repos; don't hand-edit model_index.json","Validate index fields when registering third-party models"],"tags":["diffusers","config-validation"],"backgroundTag":"config-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}