sgl-project/sglang · error · ValueError
Unsupported mc_algo {mc_algo}, available: {list(SurfaceExtra
Error message
Unsupported mc_algo {mc_algo}, available: {list(SurfaceExtractors.keys())} What it means
enable_flashvdm_decoder validates the mc_algo argument against the SurfaceExtractors registry dict before constructing the surface extractor. Any mc_algo string not present as a key (typically 'mc' and 'dmc') raises this ValueError listing the valid options.
Source
Thrown at python/sglang/multimodal_gen/runtime/models/vaes/hunyuan3d_vae.py:1137
grid_logits = self.volume_decoder(latents, self.geo_decoder, **kwargs)
outputs = self.surface_extractor(grid_logits, **kwargs)
return outputs
def enable_flashvdm_decoder(
self,
enabled: bool = True,
adaptive_kv_selection=True,
topk_mode="mean",
mc_algo="dmc",
):
"""Enable or disable FlashVDM decoder for faster inference."""
if enabled:
if adaptive_kv_selection:
self.volume_decoder = FlashVDMVolumeDecoding(topk_mode)
else:
self.volume_decoder = HierarchicalVolumeDecoding()
if mc_algo not in SurfaceExtractors:
raise ValueError(
f"Unsupported mc_algo {mc_algo}, available: {list(SurfaceExtractors.keys())}"
)
self.surface_extractor = SurfaceExtractors[mc_algo]()
else:
self.volume_decoder = VanillaVolumeDecoder()
self.surface_extractor = MCSurfaceExtractor()
class ShapeVAE(VectsetVAE):
"""Shape VAE for 3D mesh generation from latent codes."""
_aliases = ["hy3dgen.shapegen.models.ShapeVAE"]
def __init__(
self,
*,
num_latents: int,
embed_dim: int,View on GitHub (pinned to 0132848349)
Solutions
- Use one of the keys printed in the error message — normally 'mc' (scikit-image marching cubes) or 'dmc' (diso DiffDMC)
- Check the SurfaceExtractors dict in hunyuan3d_vae.py for the exact registered keys in your version
- If adding a custom extractor, register it: SurfaceExtractors['my_algo'] = MyExtractor before calling enable_flashvdm_decoder
Example fix
// before model.enable_flashvdm_decoder(enabled=True, mc_algo='marching_cubes') // after model.enable_flashvdm_decoder(enabled=True, mc_algo='mc')
Defensive patterns
Strategy: validation
Validate before calling
from sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae import SurfaceExtractors
mc_algo = 'mc' # or 'dmc'
assert mc_algo in SurfaceExtractors, f'mc_algo must be one of {list(SurfaceExtractors)}'
model.enable_flashvdm_decoder(enabled=True, mc_algo=mc_algo) Type guard
def is_valid_mc_algo(name: str) -> bool:
from sglang.multimodal_gen.runtime.models.vaes.hunyuan3d_vae import SurfaceExtractors
return isinstance(name, str) and name in SurfaceExtractors Try / catch
try:
model.enable_flashvdm_decoder(enabled=True, mc_algo=mc_algo)
except ValueError as e:
raise ValueError(f'bad mc_algo {mc_algo!r}; choose from mc/dmc') from e Prevention
- Derive mc_algo from the SurfaceExtractors registry keys, not from docs memory
- Watch for case: keys are lowercase ('dmc', not 'DMC')
- Register custom extractors in SurfaceExtractors before use
When it happens
Trigger: Calling enable_flashvdm_decoder(enabled=True, mc_algo=...) with a typo'd or unsupported algorithm name, e.g. 'marching_cubes', 'DMC', or 'cuda_dmc'. The check only runs when enabled=True and adaptive_kv_selection path is configured.
Common situations: Copying an mc_algo value from a different codebase or model card; case mismatch ('DMC' vs 'dmc'); custom forks that register an extractor under a new name but forget to add it to SurfaceExtractors.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unsupported topk_mode {topk_mode}
- Invalid causality_axis: {causality_axis}
- Please install diso via `pip install diso`, or set mc_algo t
- Unsupported down_block_type: {down_block_type}
- Unsupported time_compression_ratio: {temporal_compression_ra
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/9cecab9c2bd064b5.
Report an issue: GitHub.