alibaba/spring-ai-alibaba · error · IllegalArgumentException
评测集列配置错误,必须包含input和reference_output两列
Error message
评测集列配置错误,必须包含input和reference_output两列
What it means
Thrown by DatasetServiceImpl.create() when columnsConfig is missing or does not contain the required 'input' and 'reference_output' columns, as checked by hasRequiredColumns(). Evaluation datasets must have this fixed schema.
Solutions
- Ensure columnsConfig includes both an 'input' column and a 'reference_output' column
- Use the schema produced by the platform's dataset-creation UI/export as a template
- Add client-side validation of column names before submitting
- Call hasRequiredColumns-equivalent check (or the validation API) before create
Example fix
// before
columnsConfig = [{"name":"question"},{"name":"answer"}];
// after
columnsConfig = [{"name":"input"},{"name":"reference_output"}]; Defensive patterns
Strategy: validation
Validate before calling
Set<String> names = columns.stream().map(ColumnDef::getName).collect(Collectors.toSet());
if (!names.contains("input") || !names.contains("reference_output")) { throw new IllegalArgumentException("columnsConfig must define input and reference_output"); } Type guard
boolean hasRequiredColumns(List<ColumnConfig> cols) { return cols != null && cols.stream().map(ColumnConfig::getName).collect(Collectors.toSet()).containsAll(Set.of("input","reference_output")); } Try / catch
try { datasetService.create(req); } catch (IllegalArgumentException e) { if (e.getMessage().contains("列配置")) { showSchemaErrorToUser(); } else { throw e; } } Prevention
- Generate columnsConfig from the platform's official schema template
- Validate column names client-side against the required set
- Lock schema for evaluation datasets instead of free-form columns
When it happens
Trigger: Creating a dataset whose columnsConfig JSON lacks 'input' or 'reference_output' column definitions; passing null columnsConfig; importing a dataset exported from another tool with a different schema.
Common situations: Hand-written columns config missing a column; renamed columns; upstream export format changed; deserialization typo in the columns key.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- 数据集版本数据量为0或不存在
- AgentCard or AgentCardProvider must be provided
- AgentScope Model must be provided for AgentScope routing…
- AgentScope routing flow requires at least one sub-agent
- appName cannot be null or empty
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/96576f2530e5c36a.
Report an issue: GitHub.
Appendix: source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/service/impl/DatasetServiceImpl.java:54
private static final String INPUT_COLUMN_TYPE = "input";
private static final String REFERENCE_OUTPUT_COLUMN_TYPE = "reference_output";
@Override
@Transactional
public Dataset create(DatasetCreateRequest request) {
log.info("创建评测集: {}", request);
if (!StringUtils.hasText(request.getName())) {
throw new IllegalArgumentException("评测集名称不能为空");
}
if (request == null || request.getColumnsConfig() == null ||
!hasRequiredColumns(request.getColumnsConfig())) {
throw new IllegalArgumentException("评测集列配置错误,必须包含input和reference_output两列");
}
DatasetDO datasetDO = DatasetDO.builder()
.name(request.getName())
.description(request.getDescription())
.columnsConfig(JSONObject.toJSONString(request.getColumnsConfig()))
.build();
datasetMapper.insert(datasetDO);
log.info("评测集创建成功: {}", datasetDO);
return Dataset.fromDO(datasetDO);
}
@Override
public PageResult<Dataset> list(DatasetListRequest request) {
log.info("查询评测集列表: {}", request);
// 计算分页参数View on GitHub (pinned to f82da0b50f)