{"record":{"id":"524227a76e630036","repo":"unslothai/unsloth","slug":"unknown-format-type-format-type","errorCode":null,"errorMessage":"Unknown format_type: {format_type}","messagePattern":"Unknown format_type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/datasets/dataset_utils.py","lineNumber":862,"sourceCode":"                        \"warnings\": warnings,\n                    }\n                except Exception as e:\n                    warnings.append(f\"Standardization failed: {e}\")\n\n            return {\n                \"dataset\": dataset,\n                \"detected_format\": \"unknown\",\n                \"final_format\": \"unknown\",\n                \"chat_column\": detected[\"chat_column\"],\n                \"is_standardized\": False,\n                \"requires_manual_mapping\": True,\n                \"is_image\": multimodal_info[\"is_image\"],\n                \"multimodal_info\": multimodal_info,\n                \"warnings\": warnings,\n            }\n\n    else:\n        raise ValueError(f\"Unknown format_type: {format_type}\")\n\n\ndef format_and_template_dataset(\n    dataset,\n    model_name,\n    tokenizer,\n    is_vlm = False,\n    format_type = \"auto\",\n    # VLM-specific parameters\n    vlm_instruction = None,  # Now optional - will auto-generate\n    vlm_text_column = None,\n    vlm_image_column = None,\n    dataset_name = None,\n    custom_prompt_template = None,\n    add_eos_token = False,\n    remove_bos_prefix = False,\n    custom_format_mapping = None,\n    auto_detect_custom = True,","sourceCodeStart":844,"sourceCodeEnd":880,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/datasets/dataset_utils.py#L844-L880","documentation":"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.","triggerScenarios":"Calling format_and_template_dataset(..., format_type='ChatML') (wrong case), 'instruct', 'json', or any string outside the supported set listed above.","commonSituations":"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.","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"],"exampleFix":"# before\nresult = format_and_template_dataset(ds, model, tok, format_type='ChatML')  # raises\n\n# after\nSUPPORTED = {'auto', 'raw', 'alpaca', 'chatml', 'conversational', 'sharegpt'}\nassert format_type in SUPPORTED, f\"format_type must be one of {SUPPORTED}\"\nresult = format_and_template_dataset(ds, model, tok, format_type=format_type.lower())","handlingStrategy":"validation","validationCode":"SUPPORTED_FORMAT_TYPES = {\"auto\", \"raw\", \"alpaca\", \"chatml\", \"conversational\", \"sharegpt\"}\n\ndef is_supported_format_type(format_type: str) -> bool:\n    return format_type in SUPPORTED_FORMAT_TYPES","typeGuard":"def normalize_format_type(value: str) -> str:\n    v = (value or \"auto\").strip().lower()\n    if v not in {\"auto\", \"raw\", \"alpaca\", \"chatml\", \"conversational\", \"sharegpt\"}:\n        raise ValueError(f\"unsupported format_type: {value!r}\")\n    return v","tryCatchPattern":null,"preventionTips":["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"],"tags":["datasets","format-conversion","validation","configuration"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}