sgl-project/sglang · error · Exception

Unsupported model architecture: {arch}. Registered architect

Error message

Unsupported model architecture: {arch}. Registered architectures: {registered_models}

What it means

_normalize_archs maps aliases (via _ALIAS_TO_MODEL, e.g. 'LTX2Vocoder' to its canonical class) and then requires every architecture to be present in registered_models. Anything unregistered and unaliased raises a bare Exception listing the registered architectures. Note it raises Exception, so catching ValueError alone will not intercept it.

Source

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

    ) -> list[str]:
        load_external_model_package()
        if isinstance(architectures, str):
            architectures = [architectures]
        if not architectures:
            logger.warning("No model architectures are specified")

        normalized_arch = []
        for arch in architectures:
            if arch not in self.registered_models:
                # A checkpoint may name a class that is only a rename of one we
                # already implement (e.g. LTX-2.5's `LTX2VocoderWithBWE` is
                # `LTX2Vocoder`); `_aliases` declares those equivalences.
                canonical = _ALIAS_TO_MODEL.get(arch)
                if canonical is not None and canonical in self.registered_models:
                    normalized_arch.append(canonical)
                    continue
                registered_models = list(self.registered_models.keys())
                raise Exception(
                    f"Unsupported model architecture: {arch}. Registered architectures: {registered_models}"
                )
            normalized_arch.append(arch)
        return normalized_arch

    def inspect_model_cls(
        self,
        architectures: str | list[str],
    ) -> tuple[_ModelInfo, str]:
        architectures = self._normalize_archs(architectures)

        for arch in architectures:
            model_info = self._try_inspect_model_cls(arch)
            if model_info is not None:
                return (model_info, arch)

        return self._raise_for_unsupported(architectures)

View on GitHub (pinned to 0132848349)

Solutions

  1. Register the architecture (or its canonical class) with register_model before calling resolve/inspect
  2. If you added an alias, confirm the canonical name it maps to is itself in registry.registered_models
  3. Diff the requested arch string against registered_models keys for typos/case
  4. Upgrade the package so the registry knows the newer architecture names
Defensive patterns

Strategy: validation

Validate before calling

registered = set(registry.registered_models) | set(_ALIAS_TO_MODEL)
assert all(a in registered for a in config.architectures), f'unregistered: {config.architectures}'

Type guard

def arch_resolvable(arch: str, registry) -> bool:
    if arch in registry.registered_models:
        return True
    canonical = _ALIAS_TO_MODEL.get(arch)
    return canonical is not None and canonical in registry.registered_models

Try / catch

try:
    archs = registry._normalize_archs(config.architectures)
except Exception as e:  # note: bare Exception, not ValueError
    ...

Prevention

When it happens

Trigger: resolve_model_cls/inspect_model_cls receiving an architecture that is neither an alias with a registered canonical name nor directly registered; also when a canonical alias target itself was never registered (alias exists, canonical missing).

Common situations: Adding a new alias in _ALIAS_TO_MODEL but forgetting to register the canonical model; plugin registration code not executed before resolution; architecture strings sourced from a newer config.json than the installed registry supports.

Related errors


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