sgl-project/sglang · error · ValueError

Model architectures failed to be inspected. Please check…

Error message

Model architectures {architectures} failed to be inspected. Please check the logs for more details.

What it means

Raised by _raise_for_unsupported when at least one requested architecture IS in the supported list, yet inspect_model_cls still failed to return a class for it — meaning registration exists but loading/inspection of the class errored (see the subprocess error) or returned nothing. It directs you to the logs for the underlying failure.

Solutions

  1. Check preceding log lines for the inspection/load failure for that architecture (often the same root cause as the subprocess RuntimeError)
  2. Verify the lazy '<module>:<class>' target still imports: python -c 'from m import C; print(C)'
  3. Re-register the model with a corrected target or pass the class directly
  4. If the class exists but inspection filters it out (abstract/wrong base), fix the class or its registration
Defensive patterns

Strategy: try-catch

Validate before calling

from importlib import import_module
mod, cls = lazy_ref.split(':')
getattr(import_module(mod), cls)  # fails fast if inspection would fail

Try / catch

try:
    model_cls = registry.resolve_model_cls(config)
except ValueError as e:
    if 'failed to be inspected' in str(e):
        log.error('registered but broken model; check earlier subprocess logs')
    raise

Prevention

When it happens

Trigger: Calling inspect_model_cls or resolve_model_cls with architectures=['FooModel'] where 'FooModel' appears in get_supported_archs(), but _try_load_model_cls returned None — e.g. the lazy module:class import failed silently or the subprocess inspection crashed.

Common situations: A model registered via lazy string whose module was renamed; partially failing registration in a plugin; an architecture registered but its inspection skipped due to a prior exception that was caught and logged.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/1077ffcc7f3c9ddc. Report an issue: GitHub.

Appendix: source

Thrown at python/sglang/multimodal_gen/runtime/models/registry.py:347

        if isinstance(model_cls, str):
            split_str = model_cls.split(":")
            if len(split_str) != 2:
                msg = "Expected a string in the format `<module>:<class>`"
                raise ValueError(msg)

            model = _LazyRegisteredModel(
                module_name=split_str[0], class_name=split_str[1]
            )
        else:
            model = _RegisteredModel.from_model_cls(model_cls)

        self.registered_models[model_arch] = model

    def _raise_for_unsupported(self, architectures: list[str]) -> NoReturn:
        all_supported_archs = self.get_supported_archs()

        if any(arch in all_supported_archs for arch in architectures):
            raise ValueError(
                f"Model architectures {architectures} failed "
                "to be inspected. Please check the logs for more details."
            )

        raise ValueError(
            f"Model architectures {architectures} are not supported for now. "
            f"Supported architectures: {all_supported_archs}"
        )

    def _try_load_model_cls(self, model_arch: str) -> type[nn.Module] | None:
        if model_arch not in self.registered_models:
            return None

        return _try_load_model_cls(model_arch, self.registered_models[model_arch])

    def _try_inspect_model_cls(self, model_arch: str) -> _ModelInfo | None:
        if model_arch not in self.registered_models:
            return None

View on GitHub (pinned to 0132848349)