Priority Level
Medium (Annoying but has workaround)
Describe the bug
DatasetProfilerResults accepts categorical histogram data with empty categories and counts lists, but to_report() crashes while rendering it:
ValueError: max() arg is an empty sequence
This prevents report generation for a schema-valid analysis result with no categorical observations.
Steps/Code to reproduce bug
from pathlib import Path
from data_designer.config.analysis.dataset_profiler import DatasetProfilerResults
document = {
"num_records": 1,
"target_num_records": 1,
"column_statistics": [
{
"column_type": "general",
"column_name": "text",
"num_records": 1,
"num_null": 0,
"num_unique": 1,
"pyarrow_dtype": "string",
"simple_dtype": "str",
}
],
"column_profiles": [
{
"column_name": "quality",
"summaries": {
"helpfulness": {
"score_name": "helpfulness",
"summary": "No observations",
"score_samples": [],
}
},
"score_distributions": {
"scores": {"helpfulness": []},
"reasoning": {"helpfulness": []},
"distribution_types": {"helpfulness": "categorical"},
"distributions": {"helpfulness": "--"},
"histograms": {
"helpfulness": {"categories": [], "counts": []},
},
},
}
],
}
results = DatasetProfilerResults.model_validate(document)
results.to_report(Path("report.html"))
Model validation succeeds, then report rendering raises ValueError: max() arg is an empty sequence.
Expected behavior
An empty categorical histogram should render an empty-state placeholder, or it should be rejected during model validation with a clear validation error. to_report() should not raise an exception for an accepted input.
Agent Diagnostic / Prior Investigation
Reproduced on the current main branch. A histogram containing one category and one count renders successfully as a negative control.
CategoricalHistogramData in packages/data-designer-config/src/data_designer/config/analysis/column_statistics.py allows empty lists. The report path converts those lists into an empty mapping and passes it to create_rich_histogram_table() in packages/data-designer-config/src/data_designer/config/utils/visualization.py, which calls max(data.values()) without checking whether the mapping is empty.
The issue tracker was searched for CategoricalHistogramData, empty categorical histograms, and max() arg is an empty sequence; no matching issue was found.
Additional context
Regression coverage should exercise the public DatasetProfilerResults.to_report() method with empty categorical histogram data. Handling the empty state in the renderer would also make the shared visualization helper more robust.
Checklist
Priority Level
Medium (Annoying but has workaround)
Describe the bug
DatasetProfilerResultsaccepts categorical histogram data with emptycategoriesandcountslists, butto_report()crashes while rendering it:This prevents report generation for a schema-valid analysis result with no categorical observations.
Steps/Code to reproduce bug
Model validation succeeds, then report rendering raises
ValueError: max() arg is an empty sequence.Expected behavior
An empty categorical histogram should render an empty-state placeholder, or it should be rejected during model validation with a clear validation error.
to_report()should not raise an exception for an accepted input.Agent Diagnostic / Prior Investigation
Reproduced on the current
mainbranch. A histogram containing one category and one count renders successfully as a negative control.CategoricalHistogramDatainpackages/data-designer-config/src/data_designer/config/analysis/column_statistics.pyallows empty lists. The report path converts those lists into an empty mapping and passes it tocreate_rich_histogram_table()inpackages/data-designer-config/src/data_designer/config/utils/visualization.py, which callsmax(data.values())without checking whether the mapping is empty.The issue tracker was searched for
CategoricalHistogramData, empty categorical histograms, andmax() arg is an empty sequence; no matching issue was found.Additional context
Regression coverage should exercise the public
DatasetProfilerResults.to_report()method with empty categorical histogram data. Handling the empty state in the renderer would also make the shared visualization helper more robust.Checklist