{"record":{"id":"fe3a17a53a0d4b41","repo":"Comfy-Org/ComfyUI","slug":"unknown-latent-format-latent-format","errorCode":null,"errorMessage":"Unknown latent_format: {latent_format}","messagePattern":"Unknown latent_format: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_pid.py","lineNumber":44,"sourceCode":"                    tooltip=\"0 = clean latent. Increase to denoise corrupted latent outputs.\",\n                ),\n            ],\n            outputs=[io.Conditioning.Output()],\n        )\n\n    @classmethod\n    def execute(cls, positive, latent, latent_format: str, degrade_sigma: float) -> io.NodeOutput:\n        samples = latent[\"samples\"]\n        if latent_format == \"flux\":\n            fmt_cls = comfy.latent_formats.Flux2 if samples.shape[1] == 128 else comfy.latent_formats.Flux\n        elif latent_format == \"sd3\":\n            fmt_cls = comfy.latent_formats.SD3\n        elif latent_format == \"sdxl\":\n            fmt_cls = comfy.latent_formats.SDXL\n        elif latent_format == \"qwenimage\":\n            fmt_cls = comfy.latent_formats.Wan21\n        else:\n            raise ValueError(f\"Unknown latent_format: {latent_format}\")\n        lq_latent = fmt_cls().process_in(samples)\n        if lq_latent.ndim == 5:\n            lq_latent = lq_latent[:, :, 0]\n        sigma_t = torch.tensor([float(degrade_sigma)], dtype=torch.float32)\n        return io.NodeOutput(node_helpers.conditioning_set_values(\n            positive, {\"lq_latent\": lq_latent, \"degrade_sigma\": sigma_t},\n        ))\n\n\nclass PiDExtension(ComfyExtension):\n    @override\n    async def get_node_list(self) -> list[type[io.ComfyNode]]:\n        return [PiDConditioning]\n\n\nasync def comfy_entrypoint() -> PiDExtension:\n    return PiDExtension()\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_pid.py#L26-L62","documentation":"Raised by the PiD (Perceptual Image Distillation) conditioning node when the latent_format combo string matches none of flux/sd3/sdxl/qwenimage. The choice selects the comfy.latent_formats class used to process_in the latents; an unknown string means no latent format contract can be applied.","triggerScenarios":"Calling the node via the HTTP API or an edited workflow with latent_format outside {'flux','sd3','sdxl','qwenimage'} (e.g. 'sd15', 'Flux' with wrong capitalization, 'wan').","commonSituations":"Using PiD with an unsupported model family (SD1.5, AuraFlow); API scripts hardcoding format names that drift from the combo; copy-pasting workflows between ComfyUI versions where the option list changed.","solutions":["Set latent_format to one of the exact strings: 'flux', 'sd3', 'sdxl', 'qwenimage'.","For SD1.5/other checkpoints, this node does not support them — remove the node or wait for support.","Check /object_info for the current combo options if unsure."],"exampleFix":"// before\n{\"class_type\": \"...\", \"inputs\": {\"latent_format\": \"sd15\", ...}}\n// after\n{\"class_type\": \"...\", \"inputs\": {\"latent_format\": \"sdxl\", ...}}","handlingStrategy":"validation","validationCode":"VALID_PID_FORMATS = {'flux', 'sd3', 'sdxl', 'qwenimage'}\nif latent_format not in VALID_PID_FORMATS:\n    raise ValueError(f\"latent_format must be one of {sorted(VALID_PID_FORMATS)}\")","typeGuard":"def is_valid_pid_format(fmt: str) -> bool:\n    return fmt in {'flux', 'sd3', 'sdxl', 'qwenimage'}","tryCatchPattern":null,"preventionTips":["Fetch current combo options from /object_info when scripting prompts.","Match latent_format to the checkpoint family actually loaded in the workflow."],"tags":["pid","conditioning","latent-format","invalid-argument"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}