unslothai/unsloth · error · ValueError

No valid conversation column found in {dataset.column_names}

Error message

No valid conversation column found in {dataset.column_names}. Expected a 'conversations' column with 'from'/'value' or 'role'/'content' turn keys.

What it means

ValueError from find_none_sharegpt when column auto-detection fails: _probe_conversation was restricted to the single candidate 'conversations' (so a healthy 'messages' column never substitutes for a corrupt 'conversations' one), and probing that column found no turns with 'from'/'value' or 'role'/'content' keys. Without a structurally valid conversations column there is no ShareGPT data to scan.

Source

Thrown at studio/backend/utils/datasets/dataset_none_detect.py:390

            if len(row_findings) == len(conversation):
                stats["rows_all_none"] += 1

    return stats


# ---------------------------------------------------------------------------
# Convenience wrappers per format (all delegate to the same scan logic)
# ---------------------------------------------------------------------------


def find_none_sharegpt(dataset: Dataset, col: str = None) -> dict:
    """ShareGPT uses 'from'/'value' keys - same scan logic handles both."""
    if col is None:
        # ShareGPT lives in 'conversations'; probe only that column so a corrupt
        # one is still scanned, not replaced by healthy 'messages' (P1 fix).
        conv_info = _probe_conversation(dataset, candidates = ("conversations",))
        if conv_info is None:
            raise ValueError(
                f"No valid conversation column found in {dataset.column_names}. "
                "Expected a 'conversations' column with 'from'/'value' or 'role'/'content' turn keys."
            )
        col = conv_info["column"]
    return find_none_chatml(dataset, col = col)


def find_none_gptoss(dataset: Dataset, col: str = None) -> dict:
    """gptoss: role/content plus optional thinking/tool_calls. Only content checked."""
    if col is None:
        # gptoss lives in 'messages': target it whenever present (even if
        # corrupt); fall back to 'conversations' only if 'messages' is absent.
        if "messages" in dataset.column_names:
            conv_info = _probe_conversation(dataset, candidates = ("messages",))
        else:
            conv_info = _probe_conversation(dataset, candidates = ("conversations",))
        if conv_info is None:
            raise ValueError(

View on GitHub (pinned to 203007d190)

Solutions

  1. Rename your conversation column to 'conversations' and make each turn a dict with 'from'/'value' or 'role'/'content' keys
  2. Pass the column explicitly if it exists but is named differently AND has valid turn keys: find_none_sharegpt(dataset, col='...')
  3. If the data is actually role/content chatml, scan with fmt='chatml' instead of 'sharegpt'

Example fix

# before
stats = find_none_sharegpt(dataset)  # column named 'chat', turns use speaker/text

# after
dataset = dataset.rename_column('chat', 'conversations').map(
    lambda r: {'conversations': [{'from': t['speaker'], 'value': t['text']} for t in r['conversations']]}
)
stats = find_none_sharegpt(dataset)
Defensive patterns

Strategy: validation

Validate before calling

def is_sharegpt_scannable(dataset) -> bool:
    if "conversations" not in dataset.column_names:
        return False
    sample = next(iter(dataset), None)
    turns = (sample or {}).get("conversations") or []
    return bool(turns) and isinstance(turns[0], dict) and (
        {"from", "value"} <= turns[0].keys() or {"role", "content"} <= turns[0].keys()
    )

Type guard

def is_sharegpt_turn(turn) -> bool:
    return isinstance(turn, dict) and (
        ("from" in turn and "value" in turn) or ("role" in turn and "content" in turn)
    )

Prevention

When it happens

Trigger: Calling find_none_sharegpt(dataset) where the dataset has no 'conversations' column at all, or has one whose turn dicts use unrecognized keys (e.g. {'speaker','text'}) or are not dicts (strings/None).

Common situations: Datasets exported from custom pipelines with renamed keys; rows where conversations is null so the probe sees no valid turn keys; assuming ShareGPT format because the loader name says so while the actual schema is Alpaca or plain text.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/3bfc4c52fb044e0b. Report an issue: GitHub.