huggingface/transformers · error · ValueError
Unknown exporter type, got {name} - supported exporters are:
Error message
Unknown exporter type, got {name} - supported exporters are: {list(AUTO_EXPORT_CONFIG_MAPPING.keys())} What it means
Raised by AutoExportConfig.from_dict when the 'export_format' key of the config dict (given as a plain string or an ExportFormat enum) does not match any name registered in AUTO_EXPORT_CONFIG_MAPPING ('executorch', 'dynamo', 'onnx'). The error message lists the supported names so you can immediately see the valid options. It exists to stop an unsupported backend name from silently producing a wrong exporter.
Source
Thrown at src/transformers/exporters/auto.py:62
The Auto-HF export config class that takes care of automatically dispatching to the correct
export config given an export config stored in a dictionary.
"""
@classmethod
def from_dict(cls, export_config_dict: dict):
export_format = export_config_dict.get("export_format")
if export_format is None:
raise ValueError("export_config_dict must contain key 'export_format' set to exporter name")
# Allow passing an ExportFormat enum value or a plain string
if isinstance(export_format, ExportFormat):
name = export_format.value
else:
name = export_format
if name not in AUTO_EXPORT_CONFIG_MAPPING:
raise ValueError(
f"Unknown exporter type, got {name} - supported exporters are: {list(AUTO_EXPORT_CONFIG_MAPPING.keys())}"
)
target_cls = AUTO_EXPORT_CONFIG_MAPPING[name]
return target_cls.from_dict(export_config_dict)
class AutoHfExporter:
"""
The Auto-HF expoerter class that takes care of automatically instantiating to the correct
`HfExporter` given the `ExportConfig`.
"""
@classmethod
def from_config(cls, export_config: ExportConfigMixin | dict, **kwargs) -> HfExporter:
# Normalize to a dict so ``supports_export_format`` can act as the single gate.
export_config_dict = export_config.to_dict() if isinstance(export_config, ExportConfigMixin) else export_config
if not cls.supports_export_format(export_config_dict):View on GitHub (pinned to a597f97485)
Solutions
- Use one of the registered names exactly as listed in the error: 'dynamo', 'onnx', or 'executorch' (lowercase).
- If you passed an ExportFormat enum, check its .value matches a registered key (print it: the mapping keys are in the error message).
- If you genuinely need a custom backend, register a config class first with @register_export_config("<name>") on a subclass of ExportConfigMixin.
- Validate the key before calling: from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING; assert name in AUTO_EXPORT_CONFIG_MAPPING.
Example fix
# before
config = AutoExportConfig.from_dict({"export_format": "ONNX"}) # ValueError
# after
config = AutoExportConfig.from_dict({"export_format": "onnx"}) Defensive patterns
Strategy: type-guard
Validate before calling
from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING
name = cfg_dict.get("export_format")
name = name.value if hasattr(name, "value") else name
if name not in AUTO_EXPORT_CONFIG_MAPPING:
raise KeyError(f"unsupported export_format {name!r}; pick from {sorted(AUTO_EXPORT_CONFIG_MAPPING)}") Type guard
def is_known_export_format(name) -> bool:
from transformers.exporters.auto import AUTO_EXPORT_CONFIG_MAPPING
return name in AUTO_EXPORT_CONFIG_MAPPING Try / catch
try:
cfg = AutoExportConfig.from_dict(d)
except ValueError as e:
if "Unknown exporter type" in str(e):
# read the supported list from the message, prompt user/backend choice
raise
raise Prevention
- Derive the format name from AUTO_EXPORT_CONFIG_MAPPING keys, never hardcode strings
- Freeze export_config.json schema checks in CI: assert d['export_format'] in AUTO_EXPORT_CONFIG_MAPPING
- Remember names are lowercase and case-sensitive
When it happens
Trigger: Calling AutoExportConfig.from_dict({...}) with export_format set to a typo or unregistered backend, e.g. 'onnxruntime', 'tflite', 'trt', 'torchscript', or 'ONNX' (case-sensitive), or passing an ExportFormat enum whose .value is not a registered key.
Common situations: Migrating from the legacy transformers.onnx CLI names to the new exporters API; hand-writing an export_config.json for a checkpoint; typos and casing mismatches; expecting a backend that requires third-party registration via register_export_config().
Related errors
- export_config_dict must contain key 'export_format' set to e
- Unsupported export config: {export_config_dict!r}. Registere
- Per-component `config` dict is missing entries for: {sorted(
- out_indices must be a list, got {type(self._out_indices)}
- out_indices must be valid indices for stage_names {self.stag
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/14978ed39a55aada.
Report an issue: GitHub.