{"record":{"id":"f5f84bd3f227de0b","repo":"unslothai/unsloth","slug":"no-messages-or-conversations-or-texts-column","errorCode":null,"errorMessage":"No 'messages' or 'conversations' or 'texts' column found.","messagePattern":"No 'messages' or 'conversations' or 'texts' column found\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/utils/datasets/format_conversion.py","lineNumber":216,"sourceCode":"):\n    \"\"\"\n    Convert ChatML (messages OR conversations) to Alpaca format.\n\n    Supports:\n    - \"messages\" or \"conversations\" column\n    - \"role\"/\"content\" (standard) or \"from\"/\"value\" (ShareGPT)\n    \"\"\"\n    is_iterable = is_streaming_dataset(dataset)\n\n    def _convert(examples):\n        chatml_data = examples.get(chat_column) if chat_column else None\n        if chatml_data is None:\n            chatml_data = (\n                examples.get(\"messages\") or examples.get(\"conversations\") or examples.get(\"texts\")\n            )\n\n        if chatml_data is None:\n            raise ValueError(\"No 'messages' or 'conversations' or 'texts' column found.\")\n\n        instructions = []\n        outputs = []\n        inputs = []\n\n        for convo in chatml_data:\n            instruction = \"\"\n            output = \"\"\n\n            for msg in convo:\n                # Standard and ShareGPT key names\n                role = msg.get(\"role\") or msg.get(\"from\")\n                content = msg.get(\"content\") or msg.get(\"value\")\n\n                # First user message -> instruction\n                if role in [\"user\", \"human\", \"input\"] and not instruction:\n                    instruction = content\n                # First assistant message -> output","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/datasets/format_conversion.py#L198-L234","documentation":"ValueError from convert_chatml_to_alpaca's row-level _convert: when no chat_column was supplied, it falls back to examples.get('messages') / 'conversations' / 'texts', and if none of the three exists the conversion has nothing to read and raises. Unlike the streaming wrappers this fires during map on any dataset kind, batch by batch.","triggerScenarios":"Calling convert_chatml_to_alpaca(dataset) without chat_column when the conversation column is named something else ('chat', 'history', 'dialog'); or passing chat_column='messages' on a dataset where that column does not exist (examples.get returns None and the fallback chain also misses).","commonSituations":"Preprocessed datasets whose columns were renamed; converting Alpaca-format data by mistake (it has no conversation column at all); column dropped by a prior select()/remove_columns() step.","solutions":["Pass the real column name: convert_chatml_to_alpaca(dataset, chat_column='chat')","Rename your column to a recognized name before converting: dataset.rename_column('chat', 'messages')","If the dataset is already Alpaca (instruction/output), you do not need this conversion — skip it"],"exampleFix":"# before\nalpaca = convert_chatml_to_alpaca(dataset)  # column named 'chat' -> raises\n\n# after\nalpaca = convert_chatml_to_alpaca(dataset, chat_column='chat')\n# or: dataset = dataset.rename_column('chat', 'messages')","handlingStrategy":"validation","validationCode":"RECOGNIZED_CHAT_COLUMNS = (\"messages\", \"conversations\", \"texts\")\n\ndef has_recognized_chat_column(dataset, chat_column: str | None = None) -> bool:\n    if chat_column is not None:\n        return chat_column in dataset.column_names\n    return any(c in dataset.column_names for c in RECOGNIZED_CHAT_COLUMNS)","typeGuard":"def find_chatml_column(dataset) -> str | None:\n    cols = set(dataset.column_names)\n    for c in (\"messages\", \"conversations\", \"texts\"):\n        if c in cols:\n            return c\n    return None","tryCatchPattern":null,"preventionTips":["Pass chat_column explicitly whenever the schema is non-standard","Check column_names for messages/conversations/texts before converting","Alpaca-shaped datasets don't need this conversion at all — verify the format first"],"tags":["datasets","format-conversion","alpaca","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}