{"record":{"id":"22295bd02a228afb","repo":"Comfy-Org/ComfyUI","slug":"unsupported-text-format-format-r","errorCode":null,"errorMessage":"Unsupported text format: {format!r}","messagePattern":"Unsupported text format: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_text.py","lineNumber":39,"sourceCode":"            node_id=\"SaveText\",\n            search_aliases=[\"save text\", \"write text\", \"export text\"],\n            display_name=\"Save Text\",\n            category=\"text\",\n            description=\"Save text content to a file in the output directory.\",\n            inputs=[\n                io.String.Input(\"text\", force_input=True),\n                io.String.Input(\"filename_prefix\", default=\"ComfyUI\"),\n                io.Combo.Input(\"format\", options=list(cls.FORMAT_EXTENSIONS), default=\"txt\"),\n            ],\n            outputs=[io.String.Output(display_name=\"text\")],\n            is_output_node=True,\n        )\n\n    @classmethod\n    def execute(cls, text, filename_prefix, format):\n        extension = cls.FORMAT_EXTENSIONS.get(format)\n        if extension is None:\n            raise ValueError(f\"Unsupported text format: {format!r}\")\n\n        full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(\n            filename_prefix,\n            folder_paths.get_output_directory(),\n            1,\n            1,\n        )\n\n        file = f\"{filename}_{counter:05}.{extension}\"\n        filepath = os.path.join(full_output_folder, file)\n\n        if extension == \"json\":\n            # tries to pretty print otherwise saves normally\n            try:\n                data = json.loads(text)\n                with open(filepath, \"w\", encoding=\"utf-8\") as f:\n                    json.dump(data, f, indent=2, ensure_ascii=False)\n            except json.JSONDecodeError:","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_text.py#L21-L57","documentation":"The SaveText-style node maps a format combo value to a file extension via a FORMAT_EXTENSIONS dict. If the format value is not a key in that dict (extension lookup returns None), the node refuses to save. In practice this happens when the workflow JSON carries a stale or hand-edited format value not present in the node's current combo options.","triggerScenarios":"Executing a workflow where the format widget value was serialized as something not in FORMAT_EXTENSIONS — e.g. an old value from a previous node version, a hand-edited workflow file, or a client sending an arbitrary combo string that bypasses UI validation.","commonSituations":"Loading old workflows after the node's supported format list changed; API-driven prompt submissions with an unvalidated combo string; copied nodes between graphs carrying a removed format option.","solutions":["Re-select the format in the node UI so the widget value matches a current option (e.g. txt, json)","If submitting via API, set format to one of the keys exposed by the node's define_schema combo options","Remove stale widget values from the workflow JSON"],"exampleFix":"# API prompt: use a listed option\n# before\n\"format\": \"markdown\"\n# after\n\"format\": \"txt\"","handlingStrategy":"validation","validationCode":"valid = set(SaveText.FORMAT_EXTENSIONS)  # from the node class\nif format not in valid:\n    format = \"txt\"","typeGuard":"def is_supported_text_format(fmt: str, node_cls) -> bool:\n    return fmt in node_cls.FORMAT_EXTENSIONS","tryCatchPattern":null,"preventionTips":["Always re-select combo widgets after loading old workflows","When driving the API, pull combo options from the node schema instead of hardcoding strings"],"tags":["text","save","combo-validation","file-output"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}