{"record":{"id":"6a921ea4722de14c","repo":"Comfy-Org/ComfyUI","slug":"unknown-pos-emb-cls-self-pos-emb-cls","errorCode":null,"errorMessage":"Unknown pos_emb_cls {self.pos_emb_cls}","messagePattern":"Unknown pos_emb_cls (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy/ldm/cosmos/model.py","lineNumber":217,"sourceCode":"        else:\n            self.affline_norm = nn.Identity()\n\n        self.final_layer = FinalLayer(\n            hidden_size=self.model_channels,\n            spatial_patch_size=self.patch_spatial,\n            temporal_patch_size=self.patch_temporal,\n            out_channels=self.out_channels,\n            use_adaln_lora=self.use_adaln_lora,\n            adaln_lora_dim=self.adaln_lora_dim,\n            weight_args=weight_args,\n            operations=operations,\n        )\n\n    def build_pos_embed(self, device=None, dtype=None):\n        if self.pos_emb_cls == \"rope3d\":\n            cls_type = VideoRopePosition3DEmb\n        else:\n            raise ValueError(f\"Unknown pos_emb_cls {self.pos_emb_cls}\")\n\n        logging.debug(f\"Building positional embedding with {self.pos_emb_cls} class, impl {cls_type}\")\n        kwargs = dict(\n            model_channels=self.model_channels,\n            len_h=self.max_img_h // self.patch_spatial,\n            len_w=self.max_img_w // self.patch_spatial,\n            len_t=self.max_frames // self.patch_temporal,\n            is_learnable=self.pos_emb_learnable,\n            interpolation=self.pos_emb_interpolation,\n            head_dim=self.model_channels // self.num_heads,\n            h_extrapolation_ratio=self.rope_h_extrapolation_ratio,\n            w_extrapolation_ratio=self.rope_w_extrapolation_ratio,\n            t_extrapolation_ratio=self.rope_t_extrapolation_ratio,\n            device=device,\n        )\n        self.pos_embedder = cls_type(\n            **kwargs,\n        )","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy/ldm/cosmos/model.py#L199-L235","documentation":"ComfyUI's Cosmos video DiT builds its positional-embedding module in build_pos_embed(), and the only supported class string is 'rope3d' (VideoRopePosition3DEmb). Any other value of the model config field pos_emb_cls raises ValueError at model construction. The field comes from the checkpoint's JSON config, so an unknown value almost always means an unsupported or mis-parsed Cosmos checkpoint.","triggerScenarios":"Instantiating the Cosmos transformer with a config dict whose pos_emb_cls key is missing, misspelled (e.g. 'Rope3D', 'rope_3d'), or set to a variant (e.g. 'positional_embedding_3d') that this port does not implement. Happens when a custom node loads a Cosmos-family checkpoint with a config that was not remapped to ComfyUI's expected schema.","commonSituations":"Loading a new Cosmos/Predict2-variant checkpoint whose upstream config uses a different embedding name; a custom node passing raw model config through without sanitizing pos_emb_cls; typos in hand-written model config dicts.","solutions":["Check the checkpoint's config JSON and set pos_emb_cls to \"rope3d\" (the only value this implementation supports).","If the checkpoint genuinely uses another embedding scheme, it is not supported by this port; use a Cosmos checkpoint that ships pos_emb_cls=rope3d.","Inspect how the config reaches the model (custom-node loader) and normalize/override pos_emb_cls before construction instead of editing the checkpoint."],"exampleFix":"// before (config from checkpoint)\ncfg = {\"pos_emb_cls\": \"rope_3d\", ...}\nmodel = CosmosImageToVideoModel(cfg, ...)\n\n// after\ncfg = {**raw_cfg, \"pos_emb_cls\": \"rope3d\"}  # normalize to the only supported value\nmodel = CosmosImageToVideoModel(cfg, ...)","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"rope3d\"}\nassert cfg.get(\"pos_emb_cls\") in SUPPORTED, f\"pos_emb_cls must be one of {SUPPORTED}, got {cfg.get('pos_emb_cls')!r}\"","typeGuard":"def is_valid_cosmos_pos_emb_cls(cfg: dict) -> bool:\n    return cfg.get(\"pos_emb_cls\") == \"rope3d\"","tryCatchPattern":"try:\n    model.build_pos_embed(device, dtype)\nexcept ValueError as e:\n    raise RuntimeError(f\"Unsupported Cosmos config: {e}; set pos_emb_cls='rope3d'\") from e","preventionTips":["Normalize checkpoint configs to ComfyUI's expected schema at load time.","Whitelist config enum fields (pos_emb_cls, pos_emb_interpolation) before model construction.","Keep a known-good Cosmos checkpoint around to diff configs against when adding new ones."],"tags":["cosmos","config","positional-embedding","model-loading"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}