{"record":{"id":"b3d8ef6a3bc3f73e","repo":"sgl-project/sglang","slug":"modality-modality-is-not-supported-supported-mo","errorCode":null,"errorMessage":"Modality {modality} is not supported. Supported modalities are `video` and `audio`.","messagePattern":"Modality (.+?) is not supported\\. Supported modalities are `video` and `audio`\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py","lineNumber":424,"sourceCode":"        self.base_num_frames = int(base_num_frames)\n        self.num_attention_heads = int(num_attention_heads)\n\n        self.base_height = int(base_height)\n        self.base_width = int(base_width)\n\n        self.sampling_rate = int(sampling_rate)\n        self.hop_length = int(hop_length)\n        self.audio_latents_per_second = (\n            float(self.sampling_rate) / float(self.hop_length) / float(scale_factors[0])\n        )\n\n        self.scale_factors = tuple(int(x) for x in scale_factors)\n        self.theta = float(theta)\n        self.causal_offset = int(causal_offset)\n\n        self.modality = modality\n        if self.modality not in [\"video\", \"audio\"]:\n            raise ValueError(\n                f\"Modality {modality} is not supported. Supported modalities are `video` and `audio`.\"\n            )\n        self.double_precision = bool(double_precision)\n\n    def prepare_video_coords(\n        self,\n        batch_size: int,\n        num_frames: int,\n        height: int,\n        width: int,\n        device: torch.device,\n        fps: float = 24.0,\n        *,\n        start_frame: int = 0,\n    ) -> torch.Tensor:\n        grid_f = torch.arange(\n            start=int(start_frame),\n            end=int(num_frames) + int(start_frame),","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/ltx_2.py#L406-L442","documentation":"LTX-2's coordinate/rope preparator only knows how to build positional grids for 'video' (spatiotemporal) and 'audio' (1D time) inputs. Passing any other modality string at init fails because scale factors and grid construction are modality-specific.","triggerScenarios":"Constructing the module with modality='image', 'text', or an arbitrary string.","commonSituations":"Adapting the class for image-only generation and passing 'image'; config reuse across modalities; typo. Note: single-frame video (num_frames=1) is the supported way to do images here.","solutions":["Use modality='video' for images (single-frame video grid)","Or use modality='audio' for audio streams","Extend prepare_*_coords with a new branch if you genuinely need a new modality (code change)"],"exampleFix":"// before\ncoords_mod = LTX2Coords(..., modality=\"image\")\n\n// after\ncoords_mod = LTX2Coords(..., modality=\"video\")  # single frame for images","handlingStrategy":"validation","validationCode":"assert modality in ('video', 'audio'), f'modality {modality!r} unsupported; use \"video\" with 1 frame for images'","typeGuard":"def is_supported_modality(v: str) -> bool:\\n    return v in ('video', 'audio')","tryCatchPattern":null,"preventionTips":["Remember images = single-frame video in LTX-2","Validate modality strings in the config loader","Document supported enum values in wrappers"],"tags":["config-validation","modality","init-time","ltx2"],"backgroundTag":"unsupported-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}