unslothai/unsloth · error · ValueError
Unknown format_type: {format_type}
Error message
Unknown format_type: {format_type} What it means
ValueError from the dataset standardization dispatcher in dataset_utils: format_type did not match any handled branch. The function dispatches on format_type — 'raw', 'auto', 'alpaca', and 'chatml'/'conversational'/'sharegpt' — and the final else raises rather than guessing, since an unknown target format would silently produce the wrong schema. Auto-detected but unrecognized DATA returns a graceful 'unknown' result dict; only an unknown format_type ARGUMENT raises.
Source
Thrown at studio/backend/utils/datasets/dataset_utils.py:862
"warnings": warnings,
}
except Exception as e:
warnings.append(f"Standardization failed: {e}")
return {
"dataset": dataset,
"detected_format": "unknown",
"final_format": "unknown",
"chat_column": detected["chat_column"],
"is_standardized": False,
"requires_manual_mapping": True,
"is_image": multimodal_info["is_image"],
"multimodal_info": multimodal_info,
"warnings": warnings,
}
else:
raise ValueError(f"Unknown format_type: {format_type}")
def format_and_template_dataset(
dataset,
model_name,
tokenizer,
is_vlm = False,
format_type = "auto",
# VLM-specific parameters
vlm_instruction = None, # Now optional - will auto-generate
vlm_text_column = None,
vlm_image_column = None,
dataset_name = None,
custom_prompt_template = None,
add_eos_token = False,
remove_bos_prefix = False,
custom_format_mapping = None,
auto_detect_custom = True,View on GitHub (pinned to 203007d190)
Solutions
- Use one of the supported values: 'auto', 'raw', 'alpaca', 'chatml', 'conversational', or 'sharegpt' (lowercase)
- Default to format_type='auto' when you want the pipeline to detect the layout itself
- Validate format_type against the supported set at the config/UI boundary before invoking the pipeline
Example fix
# before
result = format_and_template_dataset(ds, model, tok, format_type='ChatML') # raises
# after
SUPPORTED = {'auto', 'raw', 'alpaca', 'chatml', 'conversational', 'sharegpt'}
assert format_type in SUPPORTED, f"format_type must be one of {SUPPORTED}"
result = format_and_template_dataset(ds, model, tok, format_type=format_type.lower()) Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_FORMAT_TYPES = {"auto", "raw", "alpaca", "chatml", "conversational", "sharegpt"}
def is_supported_format_type(format_type: str) -> bool:
return format_type in SUPPORTED_FORMAT_TYPES Type guard
def normalize_format_type(value: str) -> str:
v = (value or "auto").strip().lower()
if v not in {"auto", "raw", "alpaca", "chatml", "conversational", "sharegpt"}:
raise ValueError(f"unsupported format_type: {value!r}")
return v Prevention
- Whitelist format_type at the config/UI boundary using the supported set
- Lowercase user input before matching — the dispatcher is case-sensitive
- Use format_type='auto' when the caller doesn't have a strong reason to force a target
When it happens
Trigger: Calling format_and_template_dataset(..., format_type='ChatML') (wrong case), 'instruct', 'json', or any string outside the supported set listed above.
Common situations: Config/UI free-text format fields forwarded unvalidated; casing mismatches ('Alpaca' vs 'alpaca'); renamed format values after upgrading the library; mixing up dataset format names with training argument names.
Related errors
- No 'messages' or 'conversations' or 'texts' column found.
- Add a Provider connection block before running this recipe.
- Unsupported attention_backend '{value}'. Use one of: {', '.j
- Unsupported transformer_cache '{value}'. Use one of: off, au
- too many extra llama-server args (limit {MAX_EXTRA_ARG_TOKEN
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/524227a76e630036.
Report an issue: GitHub.