{"record":{"id":"6c9bfcb29c8a5301","repo":"huggingface/transformers","slug":"received-multiple-types-therefore-expected-the-fi","errorCode":null,"errorMessage":"Received multiple types, therefore expected the first type to indicate an array.","messagePattern":"Received multiple types, therefore expected the first type to indicate an array\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/integrations/ggml.py","lineNumber":390,"sourceCode":"    },\n    \"minimax_m2\": {\n        # MiniMax-M2 uses routing bias (e_score_correction_bias) for MoE expert selection,\n        # but this is not stored in GGUF metadata. Set it as default so the model weights\n        # (which include e_score_correction_bias tensors) are loaded correctly.\n        \"use_routing_bias\": True,\n    },\n}\n\n\ndef _gguf_parse_value(_value, data_type):\n    if not isinstance(data_type, list):\n        data_type = [data_type]\n    if len(data_type) == 1:\n        data_type = data_type[0]\n        array_data_type = None\n    else:\n        if data_type[0] != 9:\n            raise ValueError(\"Received multiple types, therefore expected the first type to indicate an array.\")\n        data_type, array_data_type = data_type\n\n    if data_type in [0, 1, 2, 3, 4, 5, 10, 11]:\n        _value = int(_value[0])\n    elif data_type in [6, 12]:\n        _value = float(_value[0])\n    elif data_type == 7:\n        _value = bool(_value[0])\n    elif data_type == 8:\n        _value = array(\"B\", list(_value)).tobytes().decode()\n    elif data_type == 9:\n        _value = _gguf_parse_value(_value, array_data_type)\n    return _value\n\n\nclass GGUFTokenizerSkeleton:\n    def __init__(self, dict_):\n        for k, v in dict_.items():","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/integrations/ggml.py#L372-L408","documentation":"GGUF metadata values can carry multiple types (when a field was read with multiple readers); in that case _gguf_parse_value requires the first type code to be 9 (GGUF's ARRAY type), treating the second as the element type. If the type list has length > 1 but does not start with 9, the structure is not an array-with-element-type and the parser cannot disambiguate, so it raises ValueError.","triggerScenarios":"Loading a .gguf file where a metadata field resolves to a multi-type entry whose first type code is not 9 — typically a malformed/nonstandard GGUF produced by third-party tools, or a partially corrupted header.","commonSituations":"Converting weights with community GGUF converters that emit nonstandard metadata fields; hand-edited GGUF files; version skew between the GGUF writer and transformers' reader (new type codes).","solutions":["Re-export or re-download the GGUF with an official/known-good converter (llama.cpp conversion tooling)","Inspect the file's metadata (e.g. `gguf-dump` from gguf-py) and fix or strip the offending field","If the file is fine, upgrade transformers — newer GGUF type handling may accept it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    model = AutoModelForCausalLM.from_pretrained(\"model.gguf\")\nexcept ValueError as e:\n    if \"expected the first type to indicate an array\" in str(e):\n        raise RuntimeError(\"Malformed GGUF metadata — re-convert with llama.cpp tooling\") from e\n    raise","preventionTips":["Produce GGUF files only with well-tested converters (llama.cpp convert scripts)","Validate third-party GGUFs with gguf-dump before loading into transformers"],"tags":["gguf","ggml","metadata-parsing","file-corruption"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}