{"record":{"id":"46abe1c3bd7a66a2","repo":"huggingface/transformers","slug":"unsupported-export-config-export-config-dict-r","errorCode":null,"errorMessage":"Unsupported export config: {export_config_dict!r}. Registered exporters: {sorted(AUTO_EXPORTER_MAPPING)}.","messagePattern":"Unsupported export config: (.+?)\\. Registered exporters: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/exporters/auto.py","lineNumber":81,"sourceCode":"                f\"Unknown exporter type, got {name} - supported exporters are: {list(AUTO_EXPORT_CONFIG_MAPPING.keys())}\"\n            )\n\n        target_cls = AUTO_EXPORT_CONFIG_MAPPING[name]\n        return target_cls.from_dict(export_config_dict)\n\n\nclass AutoHfExporter:\n    \"\"\"\n    The Auto-HF expoerter class that takes care of automatically instantiating to the correct\n    `HfExporter` given the `ExportConfig`.\n    \"\"\"\n\n    @classmethod\n    def from_config(cls, export_config: ExportConfigMixin | dict, **kwargs) -> HfExporter:\n        # Normalize to a dict so ``supports_export_format`` can act as the single gate.\n        export_config_dict = export_config.to_dict() if isinstance(export_config, ExportConfigMixin) else export_config\n        if not cls.supports_export_format(export_config_dict):\n            raise ValueError(\n                f\"Unsupported export config: {export_config_dict!r}. \"\n                f\"Registered exporters: {sorted(AUTO_EXPORTER_MAPPING)}.\"\n            )\n\n        export_format = export_config_dict[\"export_format\"]\n        name = export_format.value if isinstance(export_format, ExportFormat) else export_format\n        return AUTO_EXPORTER_MAPPING[name](**kwargs)\n\n    @classmethod\n    def from_pretrained(cls, pretrained_model_name_or_path, **kwargs) -> HfExporter | None:\n        \"\"\"\n        Load an exporter instance from a pretrained model/checkpoint that ships an export config.\n\n        **Not implemented yet** — placeholder for a first-class \"export recipe\" workflow.\n\n        The idea: model owners publish an ``export_config.json`` (or an ``export_config`` field in\n        ``config.json``) alongside their weights on the Hub. That file captures the settings the\n        owner has already validated for their architecture — the target format (``dynamo`` /","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/exporters/auto.py#L63-L99","documentation":"Raised by AutoHfExporter.from_config when supports_export_format() returns False for the supplied config — i.e. its 'export_format' is missing entirely, unknown, or only half-registered (a config class exists but no exporter class, or vice versa). The message shows the offending dict and the sorted list of fully registered exporter names ('dynamo', 'onnx', 'executorch').","triggerScenarios":"Calling AutoHfExporter.from_config(cfg) where cfg lacks the 'export_format' key; where export_format is a typo/unregistered name; or passing a dict loaded from a JSON file that stores the format under a different key (e.g. 'format' or 'backend').","commonSituations":"Loading export_config.json from a hub checkpoint whose schema drifted; converting an ExportConfigMixin to a dict with to_dict() and then mutating it; a custom exporter registered via register_exporter but without a matching register_export_config (half-registered).","solutions":["Ensure the dict has a top-level 'export_format' key set to a fully registered name: 'dynamo', 'onnx', or 'executorch'.","Pre-check with AutoHfExporter.supports_export_format(export_config_dict) — it returns False (and logs an actionable warning) instead of raising.","If a custom format is half-registered, register both halves: @register_export_config(name) on an ExportConfigMixin subclass and @register_exporter(name) on an HfExporter subclass.","If loading from JSON, verify the file schema contains \"export_format\" before calling from_config."],"exampleFix":"# before\nexporter = AutoHfExporter.from_config({\"format\": \"onnx\"})  # ValueError\n\n# after\nexporter = AutoHfExporter.from_config({\"export_format\": \"onnx\"})\n\n# or guard first\nif AutoHfExporter.supports_export_format(cfg_dict):\n    exporter = AutoHfExporter.from_config(cfg_dict)","handlingStrategy":"validation","validationCode":"from transformers.exporters.auto import AutoHfExporter\n\nif not AutoHfExporter.supports_export_format(cfg_dict):\n    # supports_export_format logs an actionable warning; fall back or fail gracefully\n    raise SystemExit(f\"export config not supported: {cfg_dict!r}\")\nexporter = AutoHfExporter.from_config(cfg_dict)","typeGuard":"def is_supported_export_config(cfg_dict: dict) -> bool:\n    from transformers.exporters.auto import AutoHfExporter\n    return AutoHfExporter.supports_export_format(cfg_dict)","tryCatchPattern":"try:\n    exporter = AutoHfExporter.from_config(cfg)\nexcept ValueError as e:\n    if \"Unsupported export config\" in str(e):\n        cfg[\"export_format\"] = pick_backend()  # repair and retry once\n        exporter = AutoHfExporter.from_config(cfg)\n    else:\n        raise","preventionTips":["Always gate from_config with supports_export_format() when configs come from user input or hub files","Schema-validate loaded JSON: require top-level 'export_format'","When registering custom exporters, register config and exporter together in the same module"],"tags":["export","config","registry","auto-class"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}