unslothai/unsloth · error · ValueError
{mode_title} training requires at least one string 'text' va
Error message
{mode_title} training requires at least one string 'text' value in {split_scope}; all {dropped_rows} rows were null or non-string. What it means
Raised by raw-text dataset preparation after filtering: every row in the split had a null or non-string 'text' value, so the filtered dataset is empty and the requested training mode has nothing to train on. Partial drops only produce a warning notice; only the all-rows-dropped case raises. The message includes the mode title and split scope for context.
Source
Thrown at studio/backend/utils/datasets/raw_text.py:97
# dropped rows or verify the result is non-empty without consuming the whole
# stream. Keep the filter, skip only the len()-based diagnostics.
if not hasattr(dataset, "__len__"):
return filtered_dataset, [
RawTextNotice(
message = (
f"{mode_title}: streaming dataset — rows with null or "
f"non-string 'text' in {split_scope} are dropped on the fly."
),
level = "info",
)
]
dropped_rows = len(dataset) - len(filtered_dataset)
if not dropped_rows:
return filtered_dataset, []
if len(filtered_dataset) == 0:
raise ValueError(
f"{mode_title} training requires at least one string 'text' value "
f"in {split_scope}; all {dropped_rows} rows were null or non-string."
)
return filtered_dataset, [
RawTextNotice(
message = (
f"{mode_title}: dropped {dropped_rows:,} row(s) with null or "
f"non-string 'text' values from {split_scope}"
),
level = "warning",
update_status = True,
)
]
def prepare_raw_text_dataset(
dataset: Dataset,View on GitHub (pinned to 203007d190)
Solutions
- Inspect the split: ds['text'] dtype and null count (e.g. sum of nulls) to confirm it is entirely empty/non-string.
- Select a split that actually contains text (usually 'train').
- If the text lives under another column, rename it to 'text' or rely on the auto-select path when no 'text' column exists at all.
- Cast non-string columns (e.g. int labels) with .cast_column('text', Value('string')) only if the values genuinely are text mislabeled by schema.
- Re-export the dataset from source with correct types.
Example fix
# before
result = prepare_raw_text(ds.select_columns(["text"])) # 'text' all NULL -> ValueError
# after
result = prepare_raw_text(ds.rename_column("body", "text")) # real text column Defensive patterns
Strategy: validation
Validate before calling
def split_has_string_text(ds, text_column="text") -> bool:
col = ds[text_column]
non_null = [v for v in col if isinstance(v, str) and v]
return len(non_null) > 0
# guard: assert split_has_string_text(ds[split]) before prepare_raw_text Type guard
def has_usable_text_column(dataset, column="text") -> bool:
feats = dataset.features
return column in feats and len(dataset.filter(
lambda r: isinstance(r[column], str) and r[column].strip(), load_from_cache_file=False
)) > 0 Try / catch
try:
filtered, notices = prepare_raw_text(ds, split_name=split)
except ValueError as e:
if "requires at least one string" in str(e):
ds = ds.rename_column(real_text_col, "text")
filtered, notices = prepare_raw_text(ds, split_name=split)
else:
raise Prevention
- Check null counts and dtype of 'text' per split before training.
- For streaming datasets rely on the on-the-fly drop notice instead of pre-filtering.
- Rename the true text column to 'text' at load time.
- Sanity-check that the chosen split actually contains data (len(ds[split]) > 0).
When it happens
Trigger: Calling raw text preparation on a dataset whose 'text' column is entirely null, or typed as non-string (e.g. all ints/floats/lists), for the selected split. For streaming datasets this error cannot fire (rows are dropped on the fly with an info notice instead).
Common situations: Dataset loaded with the wrong split that happens to have no text (e.g. a metadata-only aux split); text stored under a different column name while 'text' exists but is null; parquet column typed as binary/list after a bad conversion; user selected 'test' split of a dataset that only populates 'train'.
Related errors
- No captioned images found. Provide a metadata.jsonl / captio
- S3 prefix contains mixed dataset formats ({', '.join(familie
- s3_config.bucket is required
- No supported dataset files ({', '.join(SUPPORTED_EXTENSIONS)
- No audio column found in dataset. Columns: {dataset.column_n
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/4d9faa72408bf6d0.
Report an issue: GitHub.